QDox
  1. QDox
  2. QDOX-226

Enum constructors are parsed to fields

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.12
    • Fix Version/s: 2.0
    • Component/s: Parser
    • Labels:
      None
    • Number of attachments :
      0

      Description

      parser.y contains the following:

      enum_constructor:
          IDENTIFIER { makeField(new TypeDef($1, 0), ""); } |
          IDENTIFIER CODEBLOCK  { makeField(new TypeDef($1, 0), ""); } |
          IDENTIFIER PARENBLOCK { makeField(new TypeDef($1, 0), ""); } |
          IDENTIFIER PARENBLOCK CODEBLOCK { makeField(new TypeDef($1, 0), ""); };
      

      This just can't be right, since fields and constructors are two completely different things.

        Activity

        Hide
        Lars K. W. Gohlke added a comment -

        just stumbling over this.

        is this also parsing A as class and enables access to the methods (Until now name and A are fields)?

        public enum MethodLocationOfEnumMethod
        {
          A()
          {
            @Override
            private void method()
            {
            };
          };
        
          public abstract void method();
        
          private void test()
          {
          };
          
          String name = "x";
        }
        
        Show
        Lars K. W. Gohlke added a comment - just stumbling over this. is this also parsing A as class and enables access to the methods (Until now name and A are fields)? public enum MethodLocationOfEnumMethod { A() { @Override private void method() { }; }; public abstract void method(); private void test() { }; String name = "x" ; }
        Hide
        Robert Scholte added a comment -

        I haven't looked at this for a while, but I think your guess is right.

        Show
        Robert Scholte added a comment - I haven't looked at this for a while, but I think your guess is right.
        Hide
        Robert Scholte added a comment -

        http://download.oracle.com/javase/tutorial/reflect/special/enumMembers.html
        In fact it seems pretty close to the java-api.
        I'll have to add at least isEnumConstant() to make it possible to recognize both type of fields.

        Show
        Robert Scholte added a comment - http://download.oracle.com/javase/tutorial/reflect/special/enumMembers.html In fact it seems pretty close to the java-api. I'll have to add at least isEnumConstant() to make it possible to recognize both type of fields.
        Robert Scholte made changes -
        Field Original Value New Value
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Robert Scholte added a comment -

        Already making some good progress.
        From rev. 1306 untill rev. 1311
        Now the JavaField and JavaClass have some extra methods and the parsing of the EnumConstants has been changed. Still have to change the parsing of the arguments and then we can start modelling.

        Show
        Robert Scholte added a comment - Already making some good progress. From rev. 1306 untill rev. 1311 Now the JavaField and JavaClass have some extra methods and the parsing of the EnumConstants has been changed. Still have to change the parsing of the arguments and then we can start modelling.
        Hide
        Robert Scholte added a comment -

        rev. 1468 contains the JavaField.getEnumConstantClass(). Still to do: the argumentList and adjust the modelwriter.

        Show
        Robert Scholte added a comment - rev. 1468 contains the JavaField.getEnumConstantClass() . Still to do: the argumentList and adjust the modelwriter.
        Robert Scholte made changes -
        Status In Progress [ 3 ] Open [ 1 ]
        Hide
        Robert Scholte added a comment -

        Looks like I'm done. During the alpha and beta releases this part needs special attention.
        Up until now it just picked up the paren-block, now it has to parse the arguments. Most of it was already covered by Annotation values, but here are some extra expressions possible.

        Show
        Robert Scholte added a comment - Looks like I'm done. During the alpha and beta releases this part needs special attention. Up until now it just picked up the paren-block, now it has to parse the arguments. Most of it was already covered by Annotation values, but here are some extra expressions possible.
        Robert Scholte made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0 [ 15636 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Robert Scholte
            Reporter:
            Robert Scholte
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: