Type Parameter Issues

This one has a lot of code. (it was too much for discord, find em here https://pastebin.com/uXUCwmVQ) The issue is in the construction of a request. I have no clue what is going on, but for some reason, I can do this with absolutely no errors:
System.out.println(Request.of(RType.INTEGER, new ArrayList<>(), 3, true));
System.out.println(Request.of(RType.INTEGER, new ArrayList<>(), 3, true));
And, yes, I tried this:
System.out.println(new Request<>(RType.INTEGER, new ID(""), true));
System.out.println(new Request<>(RType.INTEGER, new ID(""), true));
For some reason, I can set an integer to a boolean? I think I am a very advanced programmer, but this has me stumped. Any help appreciated!
22 Replies
JavaBot
JavaBot15mo ago
This post has been reserved for your question.
Hey @The Typhothanian! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
The Typhothanian
The TyphothanianOP15mo ago
Wdym Well Boolean doesn't extend integer, so I have no clue why it's allowing me to do that And same with other stuff like strings
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
The Typhothanian
The TyphothanianOP15mo ago
Well that's not how it's worked for me in the past And I'm doing Boolean no boolean I'm pretty sure
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
The Typhothanian
The TyphothanianOP15mo ago
Ok But there is no string, only String, so I have no clue on that one
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
The Typhothanian
The TyphothanianOP15mo ago
Yeah. If I add a variable like Request<Integer> it recognizes it as an error. Is there a way to adjust the method to fix it? I don't want to have to state the class twice to get it to work.
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
The Typhothanian
The TyphothanianOP15mo ago
So how to fix that
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
The Typhothanian
The TyphothanianOP15mo ago
Ye I'm on phone too And that kinda defeats the purpose of the enum. If it's the hard then I guess I'll just use strings for identifiers.
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
The Typhothanian
The TyphothanianOP15mo ago
Cool I meant because this is for server-client stuff, so it will need to be serializable, any ideas on a method that can get the variable name? Actually better idea: integer id
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
The Typhothanian
The TyphothanianOP15mo ago
What is java reflection?
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
The Typhothanian
The TyphothanianOP15mo ago
oh just asked chat gpt so I think I understand more looks cool thank you
JavaBot
JavaBot15mo ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
JavaBot
JavaBot15mo ago
Post Closed
This post has been closed by <@801145088830210129>.

Did you find this page helpful?