Spyke

var context = RuntimeSingletonFactory.getCurrentFactory().getCurrentRuntimeSingleton().getContext()

3
4amreply
lemm.ee

It’s also an inside Joke

23
RonSijmreply
programming.dev

Is it Java? It looked like Microsoft Java C# to me...

    public static void Main(string[] args)
    {
        var meme = new Meme();
        var joke = GetTheJoke(meme);
    }
    
    public static Joke GetTheJoke(Meme theMeme)
    {
        var memeType = typeof(Meme);
        var jokeField = memeType.GetField("Joke", BindingFlags.NonPublic | BindingFlags.Instance);
        return (Joke)jokeField.GetValue(theMeme);
    }
16

Yea, what @[email protected] posted is actually Java

What even is the point of creating standards if you design backdoors to them

If you're building in a backdoor anyways, why would the backdoor require 5 lines of weird reflection to get the type, type info, fieldinfo with the correct binding flags, and then invoking the method?

I think it's kinda neat compared to C#, just being able to say "Ignore private/protected/internal keywords"

1

Reflection is sometimes a necessary evil. At least it makes it harder to abuse the class and if you do, then you are responsible if something goes wrong.

1
sudoreply
programming.dev

Immutable members. Set in constructor then read only. The Builder pattern is acceptable if you're language is an obstacle.

4
Piafrausreply
lemmy.world

So do you create new objects every time you need to change state?

3
sudoreply
programming.dev

You avoid having mutable state as much as possible. This is a pretty standard concept these days.

3

Can you please give me an example - let's say I have a big list of numbers and I need to find how many times each number is there.

I would expect a mutable dictionary/map and a single pass through. How would you do that without mutable datastructure?

2
lemmy.ml

Is it possible to get the joke at runtime using the spectre exploit?

14

You reached the end