title: Exception in thread "main" java.lang.IllegalStateException: No data of this type found. Use containsData to check for this first
body: <p>i tried to get the inherited methods and fields from java source code
  but i have this problem :</p>
  
  <p>i tried to find inherited methods and fields from each class in my file which contained java code source , the syntax is correct but i have some errors when executing the program </p>
  
  <pre><code>cu.accept(new VoidVisitorAdapter&lt;Void&gt;() {
  
          public void visit(ClassOrInterfaceDeclaration cid, Void arg) {
              super.visit(cid, arg);
  
              cid.resolve().getAllFields().stream().forEach(af -&gt; {
                  nmbre_attribus++;
              });
  
              cid.resolve().getDeclaredFields().stream().forEach(df -&gt; {
                  Nmbre_attributs_déclarées++;
              });
  
              cid.resolve().getAllMethods().stream().forEach(am -&gt; {
                  nmbre_methds++;
              });
  
              cid.resolve().getDeclaredMethods().stream().forEach(dm -&gt; {
                  Nmbre_methodes_déclarées++;
              });
  
          }
  
      }, null);
  </code></pre>
  
  <p>when i compile the whole code i have the following errors :</p>
  
  <p>Exception in thread "main" java.lang.IllegalStateException: No data of this type found. Use containsData to check for this first.</p>
  
  <pre><code>at com.github.javaparser.ast.Node.getData(Node.java:453)
  at com.github.javaparser.ast.Node.lambda$7(Node.java:703)
  at java.util.Optional.map(Unknown Source)
  at com.github.javaparser.ast.Node.getSymbolResolver(Node.java:702)
  at com.github.javaparser.ast.body.ClassOrInterfaceDeclaration.resolve(ClassOrInterfaceDeclaration.java:276)
  at Metriques.Heritage_Attributs$1.visit(Heritage_Attributs.java:66)
  at Metriques.Heritage_Attributs$1.visit(Heritage_Attributs.java:1)
  at com.github.javaparser.ast.body.ClassOrInterfaceDeclaration.accept(ClassOrInterfaceDeclaration.java:103)
  at com.github.javaparser.ast.visitor.VoidVisitorAdapter.lambda$31(VoidVisitorAdapter.java:154)
  at java.util.ArrayList.forEach(Unknown Source)
  at com.github.javaparser.ast.NodeList.forEach(NodeList.java:268)
  at com.github.javaparser.ast.visitor.VoidVisitorAdapter.visit(VoidVisitorAdapter.java:154)
  at Metriques.Heritage_Attributs$1.visit(Heritage_Attributs.java:64)
  at Metriques.Heritage_Attributs$1.visit(Heritage_Attributs.java:1)
  at com.github.javaparser.ast.body.ClassOrInterfaceDeclaration.accept(ClassOrInterfaceDeclaration.java:103)
  at com.github.javaparser.ast.visitor.VoidVisitorAdapter.lambda$31(VoidVisitorAdapter.java:154)
  at java.util.ArrayList.forEach(Unknown Source)
  at com.github.javaparser.ast.NodeList.forEach(NodeList.java:268)
  at com.github.javaparser.ast.visitor.VoidVisitorAdapter.visit(VoidVisitorAdapter.java:154)
  at Metriques.Heritage_Attributs$1.visit(Heritage_Attributs.java:64)
  at Metriques.Heritage_Attributs$1.visit(Heritage_Attributs.java:1)
  at com.github.javaparser.ast.body.ClassOrInterfaceDeclaration.accept(ClassOrInterfaceDeclaration.java:103)
  at com.github.javaparser.ast.visitor.VoidVisitorAdapter.lambda$43(VoidVisitorAdapter.java:175)
  at java.util.ArrayList.forEach(Unknown Source)
  at com.github.javaparser.ast.NodeList.forEach(NodeList.java:268)
  at com.github.javaparser.ast.visitor.VoidVisitorAdapter.visit(VoidVisitorAdapter.java:175)
  at com.github.javaparser.ast.CompilationUnit.accept(CompilationUnit.java:130)
  at Metriques.Heritage_Attributs.main(Heritage_Attributs.java:61)
  </code></pre>