Menu

Distinction FieldDeclaration & FieldSpecifica

Developers
widheg
2009-07-31
2012-10-08
  • widheg

    widheg - 2009-07-31

    Hi all!
    In terms of Java source code, what is the distinction between a FieldDeclaration and a FieldSpecification? I write a visitor class (that extends SourceVisitor). When I visit a class declaration and want to get at the fields declared in the class I would have thought I was to use the class FieldDeclaration. But it appears that FieldSpecification is the one to use. So what does a FieldDeclaration look like in terms of Java code?
    Thanks for any hint!

     
    • Tobias Gutzmann

      Tobias Gutzmann - 2009-07-31

      Hej,
      if you look at something like
      int a = 0, b = 1;
      a FieldDeclaration is "the whole" (from "int" to ";"), while there are 2 FieldSpecifications: "a = 0" and "b = 1". Same goes for LocalVariableDeclaration/~Specification and ParameterDeclaration/~Specification. A special case for the latter is that only 1 FieldSpecification per ParameterDeclaration is allowed (Java Syntax forbids otherwise).
      Hope that helps!
      Regards,
      Tobias

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.