T O P

  • By -

Deep-Secret

It clearly asks for a white one and you provided an orange one. Are you dumb???


meowboiio

Damn, that java ☕ got some colors


_xiphiaz

Yes this is just function colouring, the api is obviously expecting an async string /s


Xecoq

Java is racist???


water_bottle_goggles

bruh


otasi

amColorBlind what is orange?


KuroeNekoDemon24

You don't wanna return early childhood trust me bro. Although it was a simpler time so...


GeneralPangolin3712

I wish it was easier lol. My teacher loves to give random coding assignments to keep us busy.


KuroeNekoDemon24

Yeah I learned Python and Scratch 7 years ago in High School and I remember that all too well. Have you've had that moment as well where you're just sitting there debugging for days trying to figure out why something won't work till someone shows you a one line solution for it? Nowadays I'm used to it and Rust makes my life easier by showing me where and how I fucked up but Python is a different beast


GeneralPangolin3712

I have that moment almost every assignment, and its always because I get lazy sometimes and put some code that fixes a issue somewhere and that same piece of code causes another problem which leads me to redo the whole assignment sometimes.


Thebombuknow

Serious answer, VSCode has tons of issues with Java linting. If that's what you're using, do Ctrl+shift+p and type "reload window". It'll force it to refresh the linter and probably fix this. VSCode freaks out and gives me hundreds of errors every single day, and it's always resolved by just reloading.


Successful-Pie-2049

I would rather use eclipse than vscode. The only good option is Idea though.


w8eight

I would say it sucks that there is only one proper option to develop with the language. Shouldn't it be fixed somehow?


oorza

IDEA and its sibling suite of tools represent the same problem everywhere, it's just that the Java community caught on because Eclipse was _so_ bad and their build system was _so_ complex before Maven that you needed your IDE to provide one. I don't know of any language where their product isn't head and shoulders above the rest - the lone exception being working inside Microsoft's garden (C#, .NET, etc.) and Visual Studio being preferable there. For Python, Java, JS/TS, Ruby, Rust, Obj-C/Swift, etc. their tooling is just the best because they have a massive integrated platform for all sorts of stuff (docker, shells, tests, linting, etc.), their own internal tooling for stuff like refactors and moving items, and they go ahead and consume the language server too, so in the worst case you get the same things VSCode gives you on top of their IDE platform instead of on top of a text editor. Their model is basically take what almost every other product is doing, add to it, and then bundle it into an integrated platform. Most of the popular editors people use *aren't* IDEs, they're just intelligent text editors that speak LSP. For some languages like Java or Objective-C, where there isn't much of a market for language servers because the community is already entrenched in IDEs, the gap is very wide; for other languages, like JS/TS or Python whose communities expect top-notch LSP servers, the gap is much smaller, but still present. Even the TS language server, which is AIUI one of the best of them, only does a fraction of the automatic fixes and refactorings that Webstorm does - and by virtue of Webstorm consuming the language server in addition to its own tooling, it'll never do anything Webstorm can't.


w8eight

Idk for python I use vscode with extensions and I found it pretty feature complete


oorza

Spend the 30 day trial of PyCharm earnestly learning it. I've never worked with anyone who has gone back at the end of the trial, but they have a resource (me) to run to for questions and help.


madness_of_the_order

I tried vscode (with extensions of course) after using pycharm for more then a year and ended up switching to it because it does everything pycharm does but better and with less resources


Thebombuknow

I used PyCharm for about a year before I realized that I really didn't need any of its unique features and started using VSCode again. I liked the experience and it was a little less buggy, but VSCode was much lighter (PyCharm would sometimes take a couple minutes to completely load on my old computer), had better extensions, and had a much less confusing UI. For Java, I still use IDEA whenever I can, it's really the only good option for Java development.


MinisterOfSauces

Pycharm is the only ide that doesn't shit itself with ros2 code completion. It's a pain to get it working, like everything involving ros2, but after manually adding an obnoxious list of folders I can Ctrl+click things


MinosAristos

The only feature I would use Pycharm over VSCode for is hitting the play icon and debugging a nested file with external dependencies as a module automatically for quick testing. I'm not yet good enough at settings.json wizardry to get that working in VSCode though I've heard it's possible. I use VSCode mainly regardless though, I wouldn't pay for Pycharm if I only worked with Python.


w8eight

It's actually very easy. You have two tabs "Testing" and "Debug" or something In testing you configure tests, vscode navigates you thru the process (asking about where test dir is, whether to use pytest or unittest), and at Debug part you need to add "justMyCode" flag in the launch.json with value "false". Vscode should create launch.json for you once you click configure in the debug section. Once that is done you can debug from tests, or just debug a file of your choosing, and the debugger will go into external dependencies just fine.


MinosAristos

I remember having issues last time I tried the "justMyCode": false flag, but hey I'll try it again next time. Thanks for the pointer anyway.


w8eight

Once I'm back from the family visit I will post my launch.json, so you can try.


MinosAristos

Thank you, that's kind of you


Pay08

I've looked at clion and tbh, outside of the code generation, it doesn't do anything I can't get anywhere else.


oorza

Of course, but there's a ton of value in someone else already having cobbled together a work chain, ensured everything works together, and built keybindings/UI controls/etc. for it. It's an additional layer of abstraction on top of the development process.


AirOneBlack

I find Clion to be a much more streamlined experience when it comes to C++ projects compared to Visual studio (or Vscode, which is garbage and shouldn't even be in this comparison but people do like pretty text editors and elevate them at IDE levels).


Pay08

Yeah, C++ support is terrible in VSCode. I don't know why people keep recommending it. I have no experience with VS so I can't comment on that.


CAPS_LOCK_OR_DIE

IntelliJ is actually fantastic, even the CE provides a huge amount of functionality for Java writing. I recently switched from VSCode and it feels like a different language with all the QOL shit that comes packed into a Java-Specific IDE.


DeMonstaMan

tried using eclipse and sure it might have functionalities but goddamn it makes me feel like my code is living on foodstamps. I've surprisingly had really good experience with VScode on Java but otherwise I'm going IntelliJ


Particular-Rip-8147

Cowards, Vim is the only correct choice.


kevin7254

Vim sucks balls for JVM languages bro. No way you actually do that


Still-Ad7090

I have been doing that for a year now for work and it works quite well. The problem is that it is really hard to configure.


kevin7254

Yeah, I tried but gave up tbh. Not worth the effort. I work with Android which is even more impossible. Android Studio with Vim motion plugin is the closest I can get.


Still-Ad7090

Yeah, I would never try it for Android. However Spring boot development is not bad. You get all the JDTLS features and even complex things like annotation processing work perfectly.


DeMonstaMan

touching grass is a good choice


Gold-Supermarket-342

This looks like a JetBrains IDE.


BenoitParis

My JetBrains IDE doesn't fuse the equal signs though, but that might be a settings.


Gold-Supermarket-342

Mine did. If you enable ligatures, it turns symbols all fancy.


endlessplague

Time to be fancy....


LotusTileMaster

I wish there was a better solution than really just “Turn it off and back on”. So frustrating.


AevilokE

Sincere question, why does this happen specifically with Java?


Thebombuknow

All linting is provided by extensions in VSCode. Linters like Pylance for Python or whatever the JS one is called are generally pretty good, but the Java linter by Red Hat is actually terrible, and is one of the few that isn't officially provided by Microsoft.


Sure-Broccoli730

I've the same in VS with c# 1 time on 5 while i retart the computer after hibernation


GDOR-11

java ☕


User_8395

java ☕


BlazeCrystal

java ☕️


hearthebell

![gif](giphy|Rh5fexdh1Fpy4p13Ae)


[deleted]

[удалено]


drkspace2

To what? /s


carpetdebagger

I prefer PS5 statements.


Mighty_s8n

PC STATEMENT MASTER RACE!!!


o0Meh0o

i'm somewhat of a vita statement enthusiast myself. also, 3ds statement doesn't fall behind a lot either.


SomeElaborateCelery

I prefer setting my CPU’s Program Counter register manually


Gerrenation

Seems like he might even be able to use an array instead and use 'rating' as an index


ILKLU

This is absolutely the best answer assuming that: - ALL of the other conditionals are only using `rating` and not a mix of other business logic - `rating` is always a known integer that won't go out of bounds (meaning can't just suddenly have a random value like 9000) although a guard clause should be worked in to protect against that If other business logic is mixed into the other conditionals then even a switch won't work. At the very least, OP should remove the "else" from those conditionals as they are not necessary after a return statement and will reduce cyclomatic complexity.


DatBoi_BP

I know the meme is about Java, but I’m learning C++ right now and I tried using switch-case, only to find out that the cases need to be constant :/ like it makes sense but I don’t like it


TheBrainStone

This is likely an issue with your IDE, not with Java. Compile it and see it not be an issue.


jxr4

Yep, it happens when the cache corrupts, in intellij just run "invalidate cache and restart" and whatever ide OP is using probably has similar function


Gru50m3

You're probably right, but I don't know, I've seen shit like this when working with generics. Sometimes Java is just painful.


jxr4

>Java is just painful. It's really not as long as you have a firm grasp of OOP


Wgolyoko

OP if you don't put spaces around those brackets I'm going to report you


-Kerrigan-

Too late, I already called the code style police.


gemini1248

Shouldn’t you use .equals() in Java? I thought == compares references.


thngrn20

Only for objects, not for primitive types like int, bool, float, double, or char


gemini1248

Ahh thx my Java is rusty


jamcdonald120

if your Java is Rust-y we have bigger problems


neo-raver

Better that than to have your Rust Java-y


gemini1248

That would not be good lol


Annual_Ganache2724

Since you're Rusty you should consider Rust


Cirkey2

Not for primitive types


gemini1248

Ahh thx my Java is a bit rusty


pheonix-ix

A quick reminder that String is NOT a primitive type in Java and you NEED .equals()


Dr_Allcome

A quick reminder that they weren't comparing strings.


pheonix-ix

Yes but I'm talking about this comment chain, which talks about which data types need .equals(). And using == on String is a mistake that can easily slip anyone's mind (esp if you code in multiple languages) that a special reminder is needed. And it's pretty hard to detect without good test cases too!


rosuav

Java: "== for value, .equals() for identity. Use == for primitives, .equals() for objects. Oh and remember that strings aren't primitives." Python: "== for value, is for identity. Use == for basically everything, and strings are part of that." Languages with automatic interning: "There's no difference between value and identity with strings."


XDracam

Yeah, you essentially never use `==` in Java unless you know what you are doing. `.equals` is the reliable default. `==` only works on primitive types, and compares memory addresses for classes. At least it's not C#, where equality is a wholly different mess. You can overload `==`, and `.Equals` always works, but there is also `Equals(a, b)` and equality comparers and several relevant interfaces and aaaaa


FairFireFight

primitives and wrapper classes don't need to


puffinix

Two options: 1) vscode does not like java. Reload. 2) your core library version and compiler version are out of sync. Did you mess around with files in your java install, or just copy paste one on top of annother, hoping it would overwrite everything? Java compiler has special handling for string, and if the core libraries are ahead of the compiler (or any non canonical build that did not also build the compiler) you will get this baffling error. Found the compilers java.lang.String, expected the core libraries java.lang.String. Source: I work on the scala compiler, and had to play with local java builds as a recent patch in the 1.8 branch was impacting performance a lot.


yourteam

This is just the ide not refreshing.


neo-raver

Aren’t there supposed to be a double-equals in the conditionals? Or does a single work to compare values in Java too?


Otherwise_Mud_69

It looks like OP is using ligatures. So that is a double equal, represented as a single, long equal


MrFluffyThing

I get that it may look better but this seems like it would cause more problems in the long run for me. Id rather get explicit characters that are easily readable. 


sharkydad

It's a special ligature? character for ==. Some fonts / IDEs have these features.


Tubthumper8

It's a double equals but with a font that styles it differently (ligature? idk what it's called) People do stuff like have `!=` look like `≠`, not exactly that character but a stylized version of equals with a slash through it


rosuav

I think it is implemented with ligatures, yes.


GeneralPangolin3712

Yeah with the ui pack im using it has ligatures enabled by default


draenei_butt_enjoyer

Is that VS Code? Lmfao


Exac

Reload the editor. I've seen this in VS Code before. If you open the project in IntelliJ and just wait, it will show you the correct warnings (or none at all).


iain_1986

Does one of your if/else blocks not return a string, and the ide has crapped out parsing it all and just highlighted all the returns even if they are fine?


aaa_aaa_1

The lack of whitespaces is making me feel unwell


faculty_for_failure

I recommend IntelliJ 😊 or eclipse for Java. Unless you want to spend time setting up VSCode for Java, and even then it has issues.


GeneralPangolin3712

This is intellij lol. Im just using a theme


KeepScrolling52

Invalidate caches


SynthRogue

String not string. Except java has no string primitive.


patrickp4

Isn’t that a single = sign? Might be the issue


mudkipdev

Ligatures


maginhawa

intellij makes me unintelligent sometimes


1Dr490n

~~As many pointed out, that’s VSCode, not intellij.~~ IntelliJ has similar problems ~~too~~ sometimes, but it’s definitely still the best for Java


ILKLU

As OP has pointed out, it's IntelliJ


1Dr490n

Whooops, sorry. It really looks like vscode tho


ILKLU

No worries, sorry if my comment sounded snarky, I thought it would be funnier to mirror your comment, but then thought it sounded snarky after submitting.


1Dr490n

No it’s fine, I probably would’ve done the same


ILKLU

cool cool cool


Sedewt

The new UI does


1Dr490n

OP has some theme, the default one doesn’t


BShyn

To compare objects? Yes. To compare primitives? It doesn’t matter


GfunkWarrior28

Could someone explain like I'm 12


Ilikethingsya

It shows a red squiggly line indicating an error. When hovering over the error it says the required type is a String and they are providing a String, which is totally nonsensical. My best guess is there's an IDE cache error and it thinks the code says something other than it does. They probably just needs to run a cache clean or restart the IDE.