1

I began to study Vaadin and wrote the code as stated in the tutorial:

List<PatientEntity> personList = new ArrayList<>();
Grid<PatientEntity> grid = new Grid<>(PatientEntity.class);

I got errors in the second line

Type 'com.vaadin.ui.Grid' does not have type parameters" () and "Diamond operator is not applicable for non-parametrized types" (<>)

Dependencies from pom.xml:

<dependencyManagement>
   <dependencies>
       <dependency>
           <groupId>com.vaadin</groupId>
           <artifactId>vaadin-bom</artifactId>
           <version>13.0.11</version>
           <type>pom</type>
           <scope>import</scope>
       </dependency>

       <dependency>
           <groupId>com.vaadin</groupId>
           <artifactId>vaadin-core</artifactId>
       </dependency>

   </dependencies>
</dependencyManagement>

xxx

cfrick
  • 35,203
  • 6
  • 56
  • 68

2 Answers2

4

Type 'com.vaadin.ui.Grid' does not have type parameters

This is not the correct package. I think this is the grid from Vaadin 8. Try com.vaadin.flow.component.grid.Grid


Edit: adding @Tazavoo's comment into my answer, as it might very well solve your problem.

Have you added a Vaadin dependency to your pom.xml? Adding it to <dependencyManagement> does not actually add it as a dependency. You should keep the vaadin-bom there, as it will control the versions, but move vaadin-core to your actual <dependencies> tag.

<dependencyManagement>
   <dependencies>
       <dependency>
           <groupId>com.vaadin</groupId>
           <artifactId>vaadin-bom</artifactId>
           <version>13.0.11</version>
           <type>pom</type>
           <scope>import</scope>
       </dependency>    
   </dependencies>
</dependencyManagement>

<dependencies>
   <dependency>
       <groupId>com.vaadin</groupId>
       <artifactId>vaadin-core</artifactId>
   </dependency>
</dependencies>

With this pom structure your IDE should automatically suggest the correct Grid import to you (after you remove the incorrect import statement of course)

kscherrer
  • 5,486
  • 2
  • 19
  • 59
  • 1
    Also, are the dependencies only in ``, or are they listed as actual dependencies as well? The `vaadin-core` dependency doesn't belong in dependency management. – Erik Lumme Aug 12 '19 at 09:49
  • cannot resolve symbol 'flow' ... i wrote "import com.vaadin.flow.component.grid.Grid;" in header of class – кирилл балашов Aug 12 '19 at 09:58
  • 1
    Have you added a Vaadin dependency to your `pom.xml`? Adding it to `` does not actually add it as a dependency. You should keep the `vaadin-bom` there, as it will control the versions, but move `vaadin-core` to your actual `` tag, see this for reference https://github.com/vaadin/skeleton-starter-flow/blob/v13/pom.xml – Erik Lumme Aug 12 '19 at 10:56
  • i dont understand what you said – кирилл балашов Aug 12 '19 at 16:59
  • @кириллбалашов https://stackoverflow.com/a/37280943/3441504 here the difference between `dependencyManagement` and `dependencies` is explained further. If you can't or don't want to understand it, just do the same in your `pom.xml` file as my code. – kscherrer Aug 13 '19 at 06:35
-1

I'm not sure but you should try to remove the PatientEntity.class from the constructor (as in the second exemple of vaadin)

PaLaSeul
  • 9
  • 5