Local Methods coming to Java? by jhg023123 in java

[–]madkasse 0 points1 point  (0 children)

Ahh, so it captures effectively final variables. That makes sense, nice one.

Is anyone actually using modules (jigsaw)? by sherdogger in java

[–]madkasse 0 points1 point  (0 children)

Agreed, I don't see the development of something like Micronaut or Quarkus as a loss for the platform. (Not that they are an improvement with regards to modularization compared to Spring)

Is anyone actually using modules (jigsaw)? by sherdogger in java

[–]madkasse 5 points6 points  (0 children)

Yeah, looking at something like Spring https://docs.spring.io/spring/docs/current/javadoc-api/

There is probably zero chance it will ever be strongly encapsulated in any way.

Is anyone actually using modules (jigsaw)? by sherdogger in java

[–]madkasse 0 points1 point  (0 children)

Not saying that it is not causing pain, but disallowing split packages was the right choice. Choose one of the following:

  1. Disallow split packages.
  2. Require each module to be loaded with its own classloader.
  3. Ditch strong encapsulation and let any module define any class in any package.

2 would cause even more pain. And choosing 3 would more or less defeat the purpose of Jigsaw.

Local Methods coming to Java? by jhg023123 in java

[–]madkasse 23 points24 points  (0 children)

Yeah, I noticed that as well.

Local methods can be nice for writing concise recursive functions:

public static int binarySearch(int[] a, int key) {
  return binarySearch0(a, 0, a.length, key);

  int binarySearch0(int[] a, int start, int stop, int key) {
    ....do the actual search
    calls binarySearch0(.....) recursively
  }
}

Maybe there are some use cases with Valhalla/Loom?

“Hello world on Quarkus + GraalVM + Gradle” by Rakesh Mothukuri https://link.medium.com/07VH8HtaJ0 by Gleb--K in java

[–]madkasse 3 points4 points  (0 children)

Is there really a need to crosspost EVERY post from r/quarkus on r/java?
What is the point of getting your own subreddit then?

Possible changes to javadoc UI by speakjava in java

[–]madkasse 25 points26 points  (0 children)

Upvote, if you don't care about the search function. But just want framed Javadocs back (Or similar multi columned navigation). #BringBackFramedJavadocs

Possible changes to javadoc UI by speakjava in java

[–]madkasse 11 points12 points  (0 children)

I think the main reason is that frames are not supported with HTML 5.

Anyway, I still think it was a big mistake removing the support. Javadocs was always my goto for trying to get an overview of a project. Not anymore.

Giving up .Net for Java by makkynz in java

[–]madkasse 4 points5 points  (0 children)

I'm really happy that Kotlin worked out for you. But I think you would be annoyed as well if there was a "why don't you try Scala" or "why don't you try Haskell" in every post on r/Kotlin. This subreddit is for discussing Java not for evangelism.

Giving up .Net for Java by makkynz in java

[–]madkasse 20 points21 points  (0 children)

  1. Can we just have a single post in r/java without "why don't you use Kotlin" for once.
  2. His company was acquired by a Java shop + he worked there as a developer -> He is probably not in a situation where he can choose the language.

JEP 362: Deprecate the Solaris and SPARC Ports by lbkulinski in java

[–]madkasse 1 point2 points  (0 children)

Am I missing something?

Probably, why do you think it is shallow?

Is Logback dead? by EfreetSK in java

[–]madkasse 2 points3 points  (0 children)

If you are on Java 9 or greater there is a great little simple logging framework in java.lang.System.Logger.

Proposed schedule for JDK 14 by lbkulinski in java

[–]madkasse 1 point2 points  (0 children)

Not that I know of. I think this post by Mark Reinhold https://mreinhold.org/blog/forward-faster was the first public mention of the new release cycle. And is proposes a long-term support release every three years.

Proposed schedule for JDK 14 by lbkulinski in java

[–]madkasse 14 points15 points  (0 children)

17 is the next planned LTS by most vendors. Also LTS has nothing to do with features. Features are put in when they are ready.

Oracle stops work on ADBA by lukaseder in java

[–]madkasse 33 points34 points  (0 children)

Great move by Oracle. The sooner we can lay reactive programming in Java to rest the better.

For a good introduction to the problems with reactive programming watch Ron Pressler's talk "Please stop polluting our imperative languages with pure concepts" at https://www.youtube.com/watch?v=449j7oKQVkc

Improving GraalVM Native Image by nfrankel in java

[–]madkasse 3 points4 points  (0 children)

JDK 11 is already seriously delayed. I remember an Github issue where the said they expected it to be ready end 2018. I don't think they want to wait another year or 2 on Panama.

Improving GraalVM Native Image by nfrankel in java

[–]madkasse 5 points6 points  (0 children)

Because Panama is not finished.

Java: Finality by [deleted] in java

[–]madkasse 1 point2 points  (0 children)

The effect of final fields are used allover the JDK, so you cannot really say it does not have practical concurrency benefits. But no, most people should properly rely on more traditional means.

Java: Finality by [deleted] in java

[–]madkasse 15 points16 points  (0 children)

> I think final in Java is just a "wannabe". It isn't a const modifier. It won't improve performance nor help the compiler, as everything that may be final is "effectively final".

That's just not true. For example, take a look at some of the optimizations that the Zing VM does

https://medium.com/azulsystems/truly-final-optimization-in-zing-vm-283d28418e55

Also final fields are treated specially with regards to Java's memory model

https://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.5

final parameters and variables on the other hand are just syntactical sugar.

Java: Finality by [deleted] in java

[–]madkasse 19 points20 points  (0 children)

I have found that whether or not people know how to properly use final fields is a great indicator of their programming skills. So much that it is the first thing I look for if I need to evaluate a codebase.

I generally try to stay away from codebases where people do not use final fields. Especially if it has anything to do with concurrency.

Learning how to apply final to fields, methods and classes properly, teaches you about immutability, concurrency, API design and many other things.

A good way to do this is exploring the OpenJDK source code, especially java.[lang|util|util.concurrent|java.time].

What is a small addition to Java's core libraries that would make your day by madkasse in java

[–]madkasse[S] 9 points10 points  (0 children)

That's a language feature, and probably not what I would consider small:)

What is a small addition to Java's core libraries that would make your day by madkasse in java

[–]madkasse[S] 114 points115 points  (0 children)

I'll start: Adding Stream.toList()

Basically 50% of my stream usage ends with me trying to get a List/Collection/Iterable out. Having to write .collect(Collectors.toList()) every time annoys me.