Change By: Tobias Mattsson (23/May/13 11:10 AM)
Description: The return type is:

{code}
Class<Generator<AutoGenerationConfiguration>> getGeneratorClass();
{code}

Which means that it has to be this exact class, or interface as it is in this case. That's obviously not what we want. We want it to be a class that implements the Generator interface with a custom configuration class as its type parameter.

It should be:

{code}
Class<? extends Generator<? extends AutoGenerationConfiguration>> getGeneratorClass();
{code}

Here's an example of the problem:

{code}
    public static class MyAutoGenerationConfiguration implements AutoGenerationConfiguration {

        @Override
        public Map<String, Object> getContent() {
            return null;
        }

        @Override
        public Class<Generator<AutoGenerationConfiguration>> getGeneratorClass() {
            return MyGenerator.class; // DOES NOT COMPILE
        }
    }

    public static class MyGenerator implements Generator<AutoGenerationConfiguration> {

        @Override
        public void generate(AutoGenerationConfiguration configuration) throws RenderException {
        }
    }
{code}


As a workaround one can cast to Class but it shouldn't be necessary.

{code}
        @Override
        public Class<Generator<AutoGenerationConfiguration>> getGeneratorClass() {
            return (Class)MyGenerator.class; // COMPILES WITH WARNING
        }
{code}
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



----------------------------------------------------------------
For list details, see: http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to