Java for some BS reason modify a fucking final const variable

>java for some BS reason modify a fucking final const variable

explain this BS.

Attached: wtf.png (1440x900, 241K)

Only the reference is constant, not the contents that the reference points to.

>using java
found your problem

So basically java copy everything and I can't do shit because It's so shit I can't use references.

how is changing the Vector2 value when there are no asignations in that part of the code?

Java is a mess, and you knew it.

Post your game.

You should read up more on Java. Clone the object instead of just passing the reference if you need to use it somewhere else.

forgot the pic

Attached: 1503969271854.png (557x605, 29K)

how do I pass by reference on java?

Attached: shit.gif (1289x749, 3.12M)

It's passed to the Player constructor on line 38. My guess is that Map_center gets changed when the Player object is moved through whatever input OP uses.

how do I pass by reference on java?

This person is right.

However, there's a misconception here that you seem to have.

Java has no concept of constness. C++ and C do. The language does not give you the ability to say "I promise not to mutate the object through this handle".

You can emulate that feature by writing a new class that represents a read-only view of objects belonging to the class in question.

I'm not a Java programmer though. Is there a library out there that defined annotations for marking methods as "mutating" or not and allows you to easily construct read-only views onto other classes?

Attached: Capture.png (190x155, 2K)

I guess I'll use unity then.

kek

Very rare

This. If you want actual immutability, make x and y inside your Vector2 class final as well.

No need to write a new class. You just need to use getter/setters.

The lack of const is not a reason to throw out the language completely. Don't give up just because you encountered one thing that you didn't expect.

Java has relatively few gotchas as far as programming languages go.

Someone using a language the way that it was intended? Fucking blasphemy

Java, as far as I know, does not have a language supported way to mark a parameter or variable const. const means that the underlying object can change out from underneath you, but you can't modify it through the handle that you have.

Having a notion of constness touches everything in your language. C++ has const and non-const methods. It has mutable to allow you to mark fields as not-subject-to-constness rules.

I've read a little bit about the @ReadOnly annotation introduced in Java 8 which seems conceptually similar to const, but I'm struggling to find good examples.

Attached: The_Great_Mighty_Poo.jpg (800x600, 151K)

Maybe you're a macaquito and you don't understand what's going on.

The variable is working as it SHOULD and the value of the pointers in the vector2 remain without being changed.

The problem here is that in a certain line of code, you're changing the values of the contents inside the vector2 object.

Hell, post your entire code and I'll help your monkey huheuheuhue ass.

>spanish
>brazil
pick one and only one

Oh, you're right. I didn't look too much into the game text. I just read "DespertA". Spanish and Portuguese are very similar anyways.

suramericano tras de eso.

Pretty much this.

You're probably structuring your code completely wrong. All those fields should not be public. Getters and setters seem like unnecessary enterprise quality™ boilerplate bullshit when you're just starting out in java, but it really does help.The reasoning behind this is that if you make a field public, the value could literally be modified anywhere by anything. It's hard to debug and leads to spaghetti.

Post input manager. I have a feeling that update calls a method on your vect2 object that mutates it.

You think c# is going to fix this for you?

is this a porn game