QDox
  1. QDox
  2. QDOX-257

Anonymus class in enum definition are not parsed.

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Given a enum.
      Given the enum has an anonymus class.
      When parsing the enum
      Then a parsing exception is thrown.

        Activity

        Hide
        Iulian Zuzu added a comment - - edited

        a unit test for this bug would be something like:

        public void testAnonymusInEnum()
           {
              final JavaProjectBuilder builder = new JavaProjectBuilder();
              final String source =
                    "package com.frequentis.taptools.smarttools.modellogger.configuration;" +
                          "public enum SmartToolsDatabaseFeederComponents implements DatabaseFeederComponent{" +
                          "   ALPHA(new WdpsLoggingConfigurator())," +
                          "   BETA(new ComponentLoggingConfigurator()   {" +
                          "      @Override" +
                          "      public void configure(            final SmartToolsDatabaseStorageStrategy smarttoolsDatabaseStorageStrategy )      { " +
                          "     }" +
                          "   });" +
                          "   private ComponentLoggingConfigurator configurator;" +
                          "   private SmartToolsDatabaseFeederComponents( final ComponentLoggingConfigurator configurator )   {     " +
                          " this.configurator = configurator;   }}";
              builder.addSource( new StringReader( source ) );
           }
        
        Show
        Iulian Zuzu added a comment - - edited a unit test for this bug would be something like: public void testAnonymusInEnum() { final JavaProjectBuilder builder = new JavaProjectBuilder(); final String source = " package com.frequentis.taptools.smarttools.modellogger.configuration;" + " public enum SmartToolsDatabaseFeederComponents implements DatabaseFeederComponent{" + " ALPHA( new WdpsLoggingConfigurator())," + " BETA( new ComponentLoggingConfigurator() {" + " @Override" + " public void configure( final SmartToolsDatabaseStorageStrategy smarttoolsDatabaseStorageStrategy ) { " + " }" + " });" + " private ComponentLoggingConfigurator configurator;" + " private SmartToolsDatabaseFeederComponents( final ComponentLoggingConfigurator configurator ) { " + " this .configurator = configurator; }}" ; builder.addSource( new StringReader( source ) ); }
        Hide
        Iulian Zuzu added a comment - - edited

        The full exception stack for the above is :

        Exception in thread "main" com.thoughtworks.qdox.parser.ParseException: syntax error @[1,271]
        	at com.thoughtworks.qdox.parser.impl.Parser.yyerror(Parser.java:1683)
        	at com.thoughtworks.qdox.parser.impl.Parser.yyparse(Parser.java:1805)
        	at com.thoughtworks.qdox.parser.impl.Parser.parse(Parser.java:1664)
        	at com.thoughtworks.qdox.library.SourceLibrary.parse(SourceLibrary.java:205)
        	at com.thoughtworks.qdox.library.SourceLibrary.parse(SourceLibrary.java:162)
        	at com.thoughtworks.qdox.library.SourceLibrary.addSource(SourceLibrary.java:91)
        	at com.thoughtworks.qdox.library.SourceLibrary.addSource(SourceLibrary.java:86)
        	at com.thoughtworks.qdox.library.SortedClassLibraryBuilder.addSource(SortedClassLibraryBuilder.java:161)
        	at com.thoughtworks.qdox.JavaProjectBuilder.addSource(JavaProjectBuilder.java:173)
        
        Show
        Iulian Zuzu added a comment - - edited The full exception stack for the above is : Exception in thread "main" com.thoughtworks.qdox.parser.ParseException: syntax error @[1,271] at com.thoughtworks.qdox.parser.impl.Parser.yyerror(Parser.java:1683) at com.thoughtworks.qdox.parser.impl.Parser.yyparse(Parser.java:1805) at com.thoughtworks.qdox.parser.impl.Parser.parse(Parser.java:1664) at com.thoughtworks.qdox.library.SourceLibrary.parse(SourceLibrary.java:205) at com.thoughtworks.qdox.library.SourceLibrary.parse(SourceLibrary.java:162) at com.thoughtworks.qdox.library.SourceLibrary.addSource(SourceLibrary.java:91) at com.thoughtworks.qdox.library.SourceLibrary.addSource(SourceLibrary.java:86) at com.thoughtworks.qdox.library.SortedClassLibraryBuilder.addSource(SortedClassLibraryBuilder.java:161) at com.thoughtworks.qdox.JavaProjectBuilder.addSource(JavaProjectBuilder.java:173)
        Hide
        Iulian Zuzu added a comment -

        tested with version

        <qdox.version>2.0-M2</qdox.version>

        Show
        Iulian Zuzu added a comment - tested with version <qdox.version>2.0-M2</qdox.version>
        Hide
        Robert Scholte added a comment -

        Seems like some parts of http://docs.oracle.com/javase/specs/jls/se8/html/jls-19.html aren't fully implemented yet. A patch with a fix would be welcome.

        Show
        Robert Scholte added a comment - Seems like some parts of http://docs.oracle.com/javase/specs/jls/se8/html/jls-19.html aren't fully implemented yet. A patch with a fix would be welcome.

          People

          • Assignee:
            Unassigned
            Reporter:
            Iulian Zuzu
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: