Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unchecked generic array creation for varargs parameter of type java.lang.Class<? extends ro.pippo.controller.Controller>[] #507

Closed
pitschr opened this issue Apr 19, 2019 · 6 comments

Comments

@pitschr
Copy link

pitschr commented Apr 19, 2019

Hello.

Today I implemented the first pippo web service and everything are fine. However, I just noticed a warning message in IntelliJ:

Warning:(71, 23) java: unchecked generic array creation for varargs parameter of type java.lang.Class<? extends ro.pippo.controller.Controller>[]

My code is more&less same as suggested in official documentation:
addControllers(HttpDaemonController.class);
(my created controller just extends the ro.pippo.controller.Controller, nothing special)

Sure, it is only a warning and we can ignore it, but do you see an opportunity to get rid off it? If you need more details, I'm happy to provide it.

KR,
Christoph

@decebals
Copy link
Member

Can you supply a quickstart project (GitHub or zip) that replicates/reproduces the problem?

More details (Java version, Pippo version, ...) help me find the problem faster.

@pitschr
Copy link
Author

pitschr commented Apr 19, 2019

Hi Decebals.

Sure. My details: Java 11.0.2, Pippo 1.12.0.

I now committed my project to GitHub and can confirm that the warning is raised in Travis as well (line 530): https://travis-ci.org/pitschr/knx-link/builds/522303944

The implementation (line 70):
https://github.com/pitschr/knx-link/blob/master/src/main/java/li/pitschmann/knx/daemon/HttpDaemonApplication.java

Let me know if you need more details.

KR,
Christoph

@decebals
Copy link
Member

The fast fix is to add SuppressWarnings annotation like

public class HttpDaemonApplication extends ControllerApplication {

    @SuppressWarnings("unchecked")
    protected void onInit() {
         // your business
    }

}

@pitschr
Copy link
Author

pitschr commented Apr 20, 2019

Yes, this is the way I have to go, I suppose. I just was wondering that it is per design. But, thank you for your clarification. KR, Christoph

p.s. pippo is a great project! well done!

@decebals
Copy link
Member

Thanks for appreciations!
In last period of time I was a little bit busy with the release of the third major version of PF4J.
After PF4J will be released, I will invest in the second version of Pippo.

If you encounter problems with Pippo, please let me know.

@pitschr pitschr closed this as completed Apr 20, 2019
@pitschr
Copy link
Author

pitschr commented Apr 20, 2019

Closed this thread as it is not critical and when resolving that in second version it would be great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants