[forge-issues] [JBoss JIRA] (ROASTER-132) Broken interface promise for JavaParser

Kai Müller (Jira) issues at jboss.org
Mon Jan 21 15:45:00 EST 2019


Kai Müller created ROASTER-132:
----------------------------------

             Summary: Broken interface promise for JavaParser
                 Key: ROASTER-132
                 URL: https://issues.jboss.org/browse/ROASTER-132
             Project: Roaster
          Issue Type: Bug
          Components: API, JDT
    Affects Versions: 2.20.8.Final
            Reporter: Kai Müller


According to the interface JavaParser the methods "create" and "parseUnit" should retunr null of the type is not supported, but the JavaParserImpl throws instead ParserException.

I can think about the following options:
#  change the behaviour in JavaParserImpl
# change the interface description, but then make multiple parsers no sense any more if the first is failing with an exception
# basically 2. but catch the exception --> ugly code (my personal opinion)
# Add a "canHandle" method, which returns true if this type of source can be handled

If think, that 1. is the easiest and cleanest solution. We should then maybe enhance the error message thrown if no parser was able to handle the source code.

What do you think?

Best regards,
Kai



--
This message was sent by Atlassian Jira
(v7.12.1#712002)



More information about the forge-issues mailing list