Readit News logoReadit News
JanecekPetr commented on JEP draft: Prepare to make final mean final   openjdk.org/jeps/8349536... · Posted by u/mfiguiere
pandemic_region · a year ago
Why the Lombok hate? It's just an innocent preprocessor allowing a bit of syntactic sugar right?
JanecekPetr · a year ago
- It doesn't work with ErrorProne (https://github.com/google/error-prone/issues?q=sort%3Aupdate...) - you need a special plugin in your IDE for the generated classes to be visible and/or the code to be parsable - it does not work with many other tools, usually there is a bridge to fix that, e.g. with MapStruct: https://mapstruct.org/faq/#Can-I-use-MapStruct-together-with...

Other tools and libraries generally do not interact in such an errorprone manner.

That said, when you know how it works, what it needs, and you know how to iron all of those tiny wrinkles, it works fine and saves you some code and/or sanity. It's not the devil, it's a powerful tool with some downsides.

JanecekPetr commented on JEP draft: Prepare to make final mean final   openjdk.org/jeps/8349536... · Posted by u/mfiguiere
throwaway92422 · a year ago
I like Lombok. The best annotation is @Builder. It makes working with records much more convenient.
JanecekPetr · a year ago
https://github.com/Randgalt/record-builder

The upsides are: - it generates code and does not do anything funky with internals, - it has a lot of knobs if you need something a little different.

The downside is that it does not provide you with the other Lombok annotations. In practice that has been OK!

JanecekPetr commented on Analyzing the codebase of Caffeine, a high performance caching library   adriacabeza.github.io/202... · Posted by u/synthc
masklinn · a year ago
Wouldn’t one hit wonders still be an issue? They might get evicted relatively fast anyway but assuming an LRU each will still take a cache entry until they go through the entire thing and finally get evicted.

Although if that’s your concern you can probably just add a smaller admission cache in front of the main cache, possibly with a promotion memory.

JanecekPetr · a year ago
That's kind of the idea of Caffeine, it has admission buffers, and it adapts automatically between LRU and LFU. The original algorithm is called Windiw TinyLFU (design https://github.com/ben-manes/caffeine/wiki/Design), see it in action e.g. here: https://github.com/ben-manes/caffeine/wiki/Efficiency
JanecekPetr commented on JEP Draft: Integrity and Strong Encapsulation   openjdk.org/jeps/8305968... · Posted by u/mfiguiere
quantumwoke · 3 years ago
As the maintainer of a large piece of Java software that interacts with legacy code in over 50% of the codebase, this was a very scary read. It sounds like the entire basis for my software which tens of thousands of people rely on every day is soon to be "restricted". I cannot prepare my users for the fact that my software _will not work with no recourse_ in the future. I understand the JVM's need for safety, but this is personally destroying my livelihood. It's along the lines of telling Ruby users one day that monkey patching will be phased out in the next release.

I suppose the next layer down the chain is to start patching code with ASM. Ugh.

JanecekPetr · 3 years ago
> "will not work with no recourse"

No, the CLI `--add-opens` CLI option will stay. In other words, applications will need to consciously enable the encapsulation-breaking stuff. Is that bad? Modern software moved to public APIs quite a bit ago. That said, if old applications want to use new JDKs, they will require quite some developement, yes.

JanecekPetr commented on Java 20: A Sneak Peek on the Panama FFM API   minborgsjavapot.blogspot.... · Posted by u/mfiguiere
gavinray · 3 years ago
Going to copy my Reddit comment over to HN because I think it's valuable:

---

One of the coolest things that's been worked on (by this same author, no less!) isn't even in the article!

Per has written a pretty-printer for MemorySegments and ByteBuffers that can hex-dump memory or render memory/buffers as their "struct" representations given some MemoryLayout.

You can also customize it with your own printers, it's wicked cool and helps so much to debug buffers when working with them.

https://github.com/openjdk/panama-foreign/pull/695

What do I mean by that? Have a look at this comment for an image of a raw memory structure layout I represented with MemoryLayout, and the pretty-print rendering of it:

https://github.com/openjdk/panama-foreign/pull/695#issuecomm...

JanecekPetr · 3 years ago
I take issue with the thing being a part of HexFormat. It should use hexformat, optionally. What if I want to dump the memory to binary or octal instead? The hexformat class itself could have been an adjustable BaseNFormatter :(.

Sorry for the tangent, it had to get out somewhere and I did not think it was worthy of an email in the actual review thread : - )

JanecekPetr commented on JEP draft: 64 bit object headers   openjdk.org/jeps/8294992... · Posted by u/mfiguiere
winrid · 3 years ago
This is very true and the suck of Java today, but fyi you can improve this exact scenario by using a special IntMap etc, which there are many libraries for (LibGDX has some, and Caffeine has off-heap maps).
JanecekPetr · 3 years ago
Not Caffeine, that's the caching library. You probably meant one of FastUtil, Eclipse Collections, Koloboke, HPPC(-RT), they all provide primitive specializations of Maps and Collections. For off-heap maps, now that's more interesting! I know about Chronicle Map, MapDB, https://github.com/snazy/ohc and https://github.com/RuedigerMoeller/fast-serialization/wiki/O....
JanecekPetr commented on SQL: The difference between WHERE and HAVING   sql-bits.com/the-differen... · Posted by u/FedericoRazzoli
JanecekPetr · 4 years ago
For me the aha moment was to understand the logical order of SQL operations: https://blog.jooq.org/a-beginners-guide-to-the-true-order-of.... Never had a problem since.
JanecekPetr commented on Log4j RCE Found   lunasec.io/docs/blog/log4... · Posted by u/usmannk
jcims · 4 years ago
Technically it's a format string vulnerability that causes a server-side request forgery that can be abused to execute code on the remote system.

I wonder of any bug bounties would give you a chain bonus for this one lol

JanecekPetr · 4 years ago
Interestingly, no, the tag doesn't have to be in the formatting string. See https://news.ycombinator.com/item?id=29507511.
JanecekPetr commented on Log4j RCE Found   lunasec.io/docs/blog/log4... · Posted by u/usmannk
kelnos · 4 years ago
On one hand I want to be more forgiving of this, because log4j is very old, and likely this feature was introduced well before we all had a collective understanding of how fiddly and difficult security can be, and how attackers will go to extreme effort to compromise our services.

But at the same time... c'mon. A logging framework's job is to ship strings to stdout or files or something. String interpolation should not be this complicated, flexible, whatever you want to call it. The idea that a logging framework (!) could even have an RCE makes me want to scream... the feature set that leads us to that even being possible just weeps "overengineered".

JanecekPetr · 4 years ago
No, this is about log4j2 which is kinda new (2.0.0 was released 2014). Otherwise, yeah, this is terrible, especially since the tag doesn't even have to be in the formatting string.
JanecekPetr commented on GC progress from JDK 8 to JDK 17   kstefanj.github.io/2021/1... · Posted by u/carimura
dandotway · 4 years ago
As Java is generally the fastest GC'd language, what's the current state of Java gamedev?

Once upon a time, this indie Java game called Minecraft became the most successful game of all time.

But from the few minutes of research I just did, Java cannot be deployed to many commercially important systems

  - Nintendo Switch
  - PlayStation
  - iOS
It appears Java is only still viable for Windows and Android, and the 1% Linux desktop market.

There used to be the GCJ project which would in theory let you run Java anywhere you had a C/C++ compiler, but Oracle's litigiousness killed that because the Java[TM] "platform" must run the official Java[TM] bytecode.

It appears C# via Monogame lets you deploy to all desktops (Win/Mac/Linux), mobiles (iOS/Android), and consoles (PS/Switch/Xbox). So ironically C# seems to now be the "write once, run anywhere" fulfillment of the original Java promise.

[EDIT: grammar.]

JanecekPetr · 4 years ago
For native binaries, we now have https://www.graalvm.org/reference-manual/native-image/, but it probably doesn't yet work nicely with game frameworks? Not sure.

There are some engines, frameworks: https://jmonkeyengine.org/, https://litiengine.com/, https://libgdx.com/, https://www.lwjgl.org/.

But I have no real experience with any of those.

u/JanecekPetr

KarmaCake day165January 21, 2014View Original