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

java.lang.ClassCastException #60

Closed
ghost opened this issue Jul 10, 2018 · 7 comments
Closed

java.lang.ClassCastException #60

ghost opened this issue Jul 10, 2018 · 7 comments

Comments

@ghost
Copy link

ghost commented Jul 10, 2018

Expected behavior and actual behavior:

To run.

{"provider":"HappyPlugin","name":"TimeViewer","commandName":"time","info":"Shows the time","code":["package io.github.xavierdd1st.commands;","import java.time.Clock;","import java.time.ZoneId;","public class TimeViewer extends Command {","public void command() {","Clock clock \u003d Clock.system(ZoneId.systemDefault());","CommandParser.setOutput( clock.toString() );","}","}"]}
Exception in thread "main" java.lang.ClassCastException: io.github.xavierdd1st.commands.TimeViewer cannot be cast to java.util.function.Supplier
	at io.github.xavierdd1st.commands.CommandParser.parseCode(CommandParser.java:23)
	at io.github.xavierdd1st.commands.CommandHandler.setup(CommandHandler.java:16)
	at io.github.xavierdd1st.Main.<init>(Main.java:21)
	at io.github.xavierdd1st.Main.main(Main.java:35)```
### Steps to reproduce the problem:
Run code;
https://github.com/XavierDD1st/TBUA
### Versions:

- jOOR: 0.9.9
- Java: 8
@lukaseder
Copy link
Member

@xavierdd1st, your free premium support credits are all used up now :)

Can you please try figuring out your mistakes on your own, first, and then if you're very sure this is a bug, come here? Thanks!

@ghost
Copy link
Author

ghost commented Jul 10, 2018

Premium support credits?

@lukaseder
Copy link
Member

Premium support credits?

I was being snarky. Never mind that comment about support credits. But please, don't just dump code somewhere and ask people to fix problems for you. Try to follow this process when you have a question:
https://stackoverflow.com/help/mcve

In the course of attempting to create an MCVE (minimum complete verifiable example), it is quite likely you will be able to answer your question yourself.

Hope this helps,
Lukas

@ghost
Copy link
Author

ghost commented Jul 11, 2018

Okay thanks. Sorry about my trouble it was just I haven't worked with mcve things before.

@lukaseder
Copy link
Member

Hey no worries at all. We've all been there before :) Just trust me on this one. By structuring a question to include an MCVE, there is a much bigger learning effect for yourself, which means more success.

@ghost
Copy link
Author

ghost commented Jul 13, 2018

The problem was so simple I forgot to implement Supplier<String>

@lukaseder
Copy link
Member

I'm glad you could find it! :)

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

No branches or pull requests

1 participant