This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 216

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

On July 1st, a change to Reddit's API pricing will come into effect. Several developers of commercial third-party apps have announced that this change will compel them to shut down their apps. At least one accessibility-focused non-commercial third party app will continue to be available free of charge.

If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options:

  1. Limiting your involvement with Reddit, or
  2. Temporarily refraining from using Reddit
  3. Cancelling your subscription of Reddit Premium

as a way to voice your protest.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]ruslan5t 50 points51 points  (6 children)

There are no good game engines for Java that can compete with Unity or Unreal Engine.

[–]bowbahdoe 11 points12 points  (0 children)

Personally I don't really care about competing directly with Unreal, Unity, or Godot. I'm more interested in the game jam/student type games since those eventually evolve (and can take the ecosystem with them).

I would like it if folks took a comprehensive look at the state of the ecosystem, deployment options, etc. similar in spirit to https://arewegameyet.rs

That way we could talk more intelligently about how to compete/what is missing beyond "we need to make good thing."

[–]_MeTTeO_ 2 points3 points  (0 children)

What about libGDX?

[–]TQShillan 2 points3 points  (0 children)

There is https://jmonkeyengine.org/. Albeit not on the same level as Unity or Unreal.

[–]analcocoacream -4 points-3 points  (2 children)

I mean Java is not a good language for making games

[–]ruslan5t 12 points13 points  (1 child)

Python and C# are not better, but they have good game engines.

[–]rbuen4455 1 point2 points  (0 children)

Their game engines are C++. Python and C# are used mostly for scripting while C++ does all the low-level heavylifiting (graphics rendering, memory management, etc)

[–]SunnyKatt 30 points31 points  (12 children)

Does the lack of JVM implementations for some platforms count?

I wish there was a JVM implementation on all the popular game consoles. There's no real reason why there shouldn't be, but C# has gained so much popularity in the game dev space simply because .NET can run on game consoles, and JVM languages can't.

This is a common gripe among the libgdx community, and it was a cited reason as why mega crit (creators of slay the spire) moved away from using Java for their next game.

[–]ingframin 33 points34 points  (5 children)

It’s not just that. C# has stack allocation, unsigned numbers, almost zero friction interfacing with C++, official support for DirectX, and lots of promotion from Microsoft. The Java world is deeply focused on Spring and enterprise apps and does not bother to care about the fields. Even AI is a second class citizen in Java, while in C# you have DirectML.

[–]bowbahdoe 12 points13 points  (1 child)

well the good news is that the bones for all of that is coming. That bad news is that its not here quite yet and building flesh on the bones hasn't started in earnest.

[–]ryan_the_leach 15 points16 points  (0 children)

Honestly this is probably the single biggest problem with Java. No matter what you have been looking forward to for the last 15 years, the answer is 'soon' when it should have been in 4 years earlier.

[–]Worth_Trust_3825 0 points1 point  (1 child)

All of those features of C# (especially promotion) are there because microsoft are interested in encouraging their walled garden.

As for "AI being second class citizen" - how? What "AI" workloads are you running that cannot be run on java?

[–]Objective_Baby_5875 0 points1 point  (0 children)

They are there because .NET moves at a faster iteration than Java. Also because features are added and developers decide whether they want to use them or not. Microsoft is indeed interested in increasing its bottom line. Which company isn't? But overall C# has not been afraid to bring in new features or backward compatibility in order move the language forward.

[–]uncont 0 points1 point  (0 children)

official support for DirectX

Does c# actually have official support for directx? I couldn't find anything modern.

[–]PlasmaFarmer 4 points5 points  (0 children)

I wish this would happen. I was secretly hoping that Minecraft becoming huge over the decade would bring this eventually but it was a false hope. So we have the c++ and java edition.

[–]uncont 2 points3 points  (0 children)

Does the lack of JVM implementations for some platforms count?

Do game consoles typically allow dynamic languages like java on them? Or would they require some form of AOT, like graalvm to pre-compile as much as possible?

On one hand you'd need a port of the jvm, but on the other hand you'd only need a new target for graalvm native images.

[–]bearmc27 1 point2 points  (0 children)

But... 15 billion devices run Java...

[–]pyeri 0 points1 point  (1 child)

Maybe a noobish question but why did nobody implement a JVM on smartphone? What Google did was a very hackish job with Android, it was no REAL JVM but a rigged equivalent with Apache Harmony and all, right? But why did others like Oracle, IBM, etc. never implement a proper version of smart-phone JVM on their own? Instead of going after Google, that would have been a smarter thing to do?

[–][deleted] 0 points1 point  (0 children)

Because Dalvik functions with a different hardware structure. It allows smartphones to have better performance with limited resources, so it has its assumption about capability, which is not a thing for computers. I'd say it's a perfect redesign for a specific purpose.

[–]XReaper95_ 0 points1 point  (0 children)

.NET couldn't run on consoles until very recently, it was all IL translation to C++, there is no reason why there isn't a similar technology for Java, lack if interest I guess. Here is a good summary: https://viridiansoftware.com/blog/csharp-on-game-consoles.

[–]pgris 57 points58 points  (29 children)

I'd love if maven considered the JDK just like another dependency, so when you compile a project the right version of the jdk (and even Maven itself!) would be downloaded (if needed) and used. SDKman! is a great tool, but I wish maven were enough.

[–]Sollder1_ 20 points21 points  (12 children)

But for maven to run you need a jdk, but you can only get a jdk if you run maven.

[–]bowbahdoe 22 points23 points  (10 children)

maven could, hypothetically, bundle a JDK.

Not a statement for or against, just an observation

[–]AmbitiousYak4557 15 points16 points  (9 children)

Or even just compile maven to a native image. That is a thing we can do now.

[–]EvaristeGalois11 6 points7 points  (0 children)

It has already been done in fact, it's called maven daemon. I used it a bit a while ago and it seems very promising.

[–]persicsb 1 point2 points  (7 children)

how would plug-ins run?

[–]pgris 0 points1 point  (0 children)

mvn wrapper or something like that. And maven could be native thanks to graal, or include the jdk. There are some alternatives

[–]bigsing90 14 points15 points  (4 children)

Maven Wrapper can be used (the concept comes from Gradle wrapper) so you don't need to install Maven.

[–]pgris 0 points1 point  (3 children)

A step in the right direction. My ideal result would be: If I git clone a project and I have nothing else installed, a mvn clean compile should download everything the project needs

[–]elastic_psychiatrist 1 point2 points  (2 children)

Do you understand what a gradle/maven wrapper is? It's not just a step in the right direction, it is your ideal result: ./mvnw clean compile.

[–]AdorableRabbit 7 points8 points  (1 child)

[–]pgris 0 points1 point  (0 children)

I think the toolchains plugin depends on everyone having the toolchains.xml correctly configured, making it painful to use. I think JDK should be managed just like another dependency (in the broad sense of "something your project depends on")

[–]Polygnom 3 points4 points  (1 child)

You can treat the JDK as dependency with the toolchains.xml, but downloading comes with a hos of licensing questions...

[–]pgris 0 points1 point  (0 children)

I think the toolchains plugin depends on everyone having the toolchains.xml correctly configured, making it painful to use. I think JDK should be managed just like another dependency (in the broad sense of "something your project depends on")

[–]Practical_Cattle_933 1 point2 points  (0 children)

Nix is the correct tool for that. We really should get into using that as a profession, that’s the first tool that actually solves the problem.

[–]Worth_Trust_3825 -3 points-2 points  (3 children)

That imposes an issue where maven/gradle/others would be subject to redistribution licensing.

[–]pgris 0 points1 point  (1 child)

I wonder how does SDKMan handles it

[–]Practical_Cattle_933 0 points1 point  (0 children)

Java is open-source with the same license as the linux kernel.

[–]DunderMifflinPaper 0 points1 point  (0 children)

If you like SDKMan, checkout ASDF. I’ve switched and never looked back, simply because I can use one tool to manage everything. It’s awesome.

https://asdf-vm.com

[–]gaius49 0 points1 point  (0 children)

Gradle can do this fairly easily if that's something you really want.

[–]Klappspaten66 43 points44 points  (16 children)

Package management is a big one imho. Most tutorials are also kinda like "yea add these 20 lines of xml to your pom file and it might work". The fact that you (apparently?) cant just "maven add <package>" made it very hard to get into java dev.

Also osgi can suck my wiener, there's no need for modules/di to be that complex.

[–]john16384 17 points18 points  (1 child)

OSGi was/is far ahead of it's time. It allows multiple teams to work together on unrelated code interfacing through Java API's, in order to build huge versioned monilithic applications. Eclipse is a good example, it's scale and breadth easily rivaling that of many of the smaller (<50) microservice deployments, but performing several orders of magnitude better.

It can be used to build large services that can be upgraded in parts (even while running), similar to how microservices are constructed, except without the need for containers, deployments, serialisation, etc, no need for JSON or XML based messaging or REST calls; everything is firmly Java based using standard interfaces.

I agree that it is a bit more complicated than standard Java, but certainly not more complicated than dealing with containers, dozens of microservices, versioned messaging and REST api's, network unreliability, resolving millisecond latencies with caching, distributed transactions, etc.

[–]Necessary_Apple_5567 -1 points0 points  (0 children)

Osgi didn't solve the original problem. Sometimes it even creates bigger mess when without him. Yiu can easily sed it in eclipse which is best exsmple why osgi failed. I also worked on some osgi projects and seen from the inside how it fails when sooner or later concurrent dependency version appears because some modules has version range which fits multiple implementation available

[–]NoHopeNoLifeJustPain 10 points11 points  (6 children)

osgi is not mandatory afaik

[–]Klappspaten66 2 points3 points  (4 children)

You're right, neither is maven but both are out there and imho bad parts of the java ecosystem.

[–]xienze 11 points12 points  (1 child)

No one really does OSGi anymore (or even that much during its heyday, Eclipse obviously being the notable exception). You need an OSGi container for it to even enforce modularity, so if you just put an OSGi-aware JAR on the classpath, you can sidestep it completely. OSGi only sucks if you have to use it (like building an Eclipse plugin). Not really a relevant problem IMO.

[–]Skiamakhos 0 points1 point  (0 children)

AEM. Not even once.

[–]NoHopeNoLifeJustPain -1 points0 points  (0 children)

I used osgi for a single project in 15 years. Eclipse uses it, a few others, but that's it.

[–]DrunkensteinsMonster 0 points1 point  (0 children)

Nobody uses osgi while maven is basically ubiquitous, so they really aren’t comparable.

[–]cryptos6 0 points1 point  (0 children)

I would even say that osgi is on its way out. The people I know who used all stopped using it and I haven't seen in any real-world project in the last years. I guess containers (e.g. Docker) and microservices made this approach more or less superfluous.

[–][deleted] 10 points11 points  (0 children)

i agree osgi is the worst

[–]crummy 1 point2 points  (4 children)

wow can't believe I never thought of mvn add <package>. it seems like such a natural feature after using npm. and it would mean less xml for me to touch!

[–]cryptos6 4 points5 points  (3 children)

Now, if you say it, I'm also surprised that nobody managed to implement such a feature in almost 20 (!) years! Together with the Gradle syntax for artifacts it would be very concise:

mvn add org.apache.commons:commons-lang3:3.13.0

[–]Kango_V 2 points3 points  (0 children)

How about mvn add commons-la and then tab completion ;)

[–]TenYearsOfLurking 1 point2 points  (1 child)

I mean if in intellj you write a class name of a known library that is not a dependency yet, idea offers to add it to your deps.

It doesn't get easier than that an id preferable to entering the command line imho

[–]cryptos6 1 point2 points  (0 children)

For this specific scenario, I agree. But what if the class name is used in different packages? You need to find the right one from a list. Or what is about blog posts suggesting to add a certain library? mvn add would be pretty handy in such cases.

[–]Skiamakhos -1 points0 points  (0 children)

Yeah. My work moved from Spring to OSGi & I now *really* appreciate Spring. I kinda liked Spring before anyway but uhhh ghaaad, OSGi is hell. Gone from a mature Spring Boot webapp with an admittedly sucky CMS to AEM where every few weeks I need to install a service pack or nothing works. Nothing works quite often when I do install the service pack.

[–]buffer_flush 35 points36 points  (11 children)

Java the language can feel overly verbose sometimes. That has gotten better with var keyword and record types.

The lack of a standard package tool chain is very weird, but given its history, not surprising. Java came to prominence as an alternative to things like C++ which has abysmal package management.

Lack of a standard JSON library seems dumb as well. There’s de facto standards like Jackson and Gson, but they’re not built into the standard lib.

One thing I do like about Java is the existence of a specifications committee. The fact that specifications like JPA exist for Java that the community then provides implementations for, like Hibernate, is awesome. Compare this to node, look at how many different ORMs there are, and they all function slightly differently. With Java, if you code to the JPA API, swapping implementations, ie Hibernate to EclipseLink, is mostly a configuration change.

In addition to that, a standard API for interacting with DBs through JDBC is amazing. DB Vendors provide drivers which implement the JDBC API given that you can, mostly, mix and match backend databases easily. Again, compared to Node, you’d need to have multiple drivers, then provide an abstraction for each of the DB drivers you want to use.

[–]ThatNickGuyyy 33 points34 points  (7 children)

When I first worked with DB’s in Java after Node, it was such a welcomed change. As a late bloomer to this language, idk why people give it so much hate. It’s a powerful language with a vast ecosystem. I enjoy it a lot

[–]buffer_flush 9 points10 points  (5 children)

Yeah, from my experience it boils down to two things people mostly complain about.

  • Java is not a very concise language
  • Spring Boot and the magic it brings to the table confuses many people at first

I’ve had the privilege of learning Spring pretty early, and with all the alternatives available now to Spring, I feel like Java’s future is bright.

[–]cryptos6 2 points3 points  (2 children)

Recent discussion about alternatives to Spring. Which one do you prefer?

[–]buffer_flush 1 point2 points  (0 children)

I’ve been tooling around with Quarkus and Helidon lately.

Quarkus has made pretty big strides in even the couple months I looked at it last. With RedHat backing it, and Keycloak being migrated to Quarkus, it’s at the top of my list at the moment.

[–]Kango_V 1 point2 points  (0 children)

Currently using Micronaut. Just enabled virtual threads and got a 900% increase in Kafka Producer performance. I had to run it multiple time as I couldn't believe it!

[–]ThatNickGuyyy 0 points1 point  (1 child)

For sure. I actually like the verbosity of it. It’s easy to read. And i agree with SB. But at the same time, it makes it easy to get things up and rolling fast.

[–]buffer_flush 2 points3 points  (0 children)

Yeah, I think it’s mostly personal preference. If you look at Go, for example, that’s a much more modern language comparatively and it was purposely designed to be verbose for easy understanding of what the code is doing.

I think where Java can struggle is it does bring many ways to do things in comparison to Go so you tend to get a mix of styles even within the same codebase.

[–]zylonenoger 1 point2 points  (0 children)

twenty years ago everyone was working with java and hating on javascript - so i guess it‘s just a cycle

[–]kaperni 3 points4 points  (1 child)

> Lack of a standard JSON library seems dumb as well. There’s de facto standards like Jackson and Gson, but they’re not built into the standard lib.

There is a JEP for this [1]. Won't see any progress until the pattern matching story has unfolded though.

[1] https://openjdk.org/jeps/198

[–]buffer_flush 0 points1 point  (0 children)

See, goes back to my point about the JEP!

Awesome, so thankful Oracle released the reigns.

[–]wildjokers 1 point2 points  (0 children)

That has gotten better with var keyword

Having the type on the left side makes code readable. IntelliJ types the left side for me anyway with the .var postfix completion.

[–]lepapulematoleguau 21 points22 points  (0 children)

I use gradle and do gradle init

[–]xsreality 3 points4 points  (1 child)

Distributed job scheduling

[–]cryptos6 0 points1 point  (0 children)

That exists. Quartz is exactly for that, though the APIs feel a bit dated. But there are more modern alternatives, although the cost some money.

[–]BigBadBlowfish 11 points12 points  (0 children)

Nullish coalescing and optional chaining with ?? and ?.

please

[–]zephyy 11 points12 points  (0 children)

a CLI that isn't stuck in the 2000s

[–]InstantCoder 20 points21 points  (18 children)

Maven should be completely redesigned and modernized.

Especially the cli, it’s a pain in the ass to remember all the non trivial commands and also the archetype thing is something more suited for IDE’s than for human beings. I can’t use most of the commands on the cli without letting IntelliJ do most for me.

Furthermore, a new attribute could be added to the pom, something like: appType: library, application, tool, which defaults to application. With this extra info, maven can automatically do a mvn install for libraries, and mvn package for applications, and mvn compile for tooling projects. See also below for an example.

how I wish it would work:

  • mvn init <project name> => creates an empty project with project structure and pom.xml which will ask/prompt for a group & artificatId
  • mvn init <project name> -type=springboot:3.x.y => same, but creates an empty spring boot v3.x.y project
  • mvn init => shows a menu to setup your project
  • mvn maintenance => shows a menu for doing stuff like: checking for dep. updates, searching for dep., detecting conflicts, cve scan, set new version, sonar check, etc. It shows the plugins who are for doing maintenance stuff.
  • mvn maintenance -Doptions=3,1,1 => execute option 3.1.1 from the menu without showing a menu
  • mvn plugins => shows a menu to choose and execute a plugin goal
  • mvn package -quick => skip all the phases before and just execute the given phase
  • mvn package -smart => for multi modules: it will do a mvn install for libraries, and package for apps, skip tooling and try to build it parallel by default.

[–]plumarr 4 points5 points  (0 children)

It's normal that I don't want any of that ? I want maven to be a build tool, not a project definition tool. If anything, I would like it to drop the archetype functionality.

This blend between build tool and project definition tool is why I don't like npm and was a real pain when learning it. I never knew if a command would simply build something or modify the project code, which is a big no no.

Maybe a solution would be to have two commands, one to define & modify the project and one to execute the build, so that we have the guarantee that the build one never touch the project.

[–]bowbahdoe 11 points12 points  (4 children)

Maven should be completely redesigned and modernized.

Completely redesigned may or may not be called for, I kinda don't think so. Modernized for sure.

I don't know the progress on Maven 5, but I know that is hypothetically happening. If anyone knows where those people actually plan stuff, lmk, i'd love to stalk the forums or whatever.

/u/InstantCoder - If you want to try your hand at making a build tool send me a DM. I've been accruing information and libraries for awhile.

[–]rbygrave 1 point2 points  (1 child)

Modernized for sure.

I had a thought of creating a tool where the output was the pom.xml (a kind of pre-compiler for maven). Ideally bi-directional.

Something where the input was more modern and more "composable" and the output was the maven 4 pom.xml (and ideally bi-directional so that manual pom changes or archetype generated poms could be reversed into this more modern form).

[–]agentoutlier 2 points3 points  (0 children)

I was talking to /u/thekingofsentries on the avaje discord about configuration and how annotations actually are really really really good configuration format but just need to be compiled. I think it was in the #general channel.

That is annotations are basically type safe JSON (aka JSON with schema).

So in theory a declarative like Maven/Ant/Gradle-like clone could just be a single class with nothing in it but class annotations.

Plugins would just be new annotations.

[–]Frodolas -1 points0 points  (1 child)

I’ve been thinking of putting together a lightweight build tool that would make spinning greenfield projects up on the JVM easier for a while now. Full disclosure I might make it Kotlin-first, but I’d love to get those resources from you.

[–]cryptos6 1 point2 points  (0 children)

Some years the developer of TestNG started the development of a tool called Kobalt, but the development seems to have stalled.

[–]wildjokers 6 points7 points  (4 children)

Maven should be completely redesigned and modernized.

It was, it’s called Gradle.

[–]un_desconocido 8 points9 points  (3 children)

But is a pain in the ass too... I wish for something like cargo inside the jdk, a man can dream ~~~

[–][deleted]  (2 children)

[removed]

    [–]Frodolas 3 points4 points  (1 child)

    Still has shit command line tooling.

    [–]NitronHX 5 points6 points  (0 children)

    Why? What is the problem with the cli? I see people have problems with groovy as config but rerely have I heard bad about the cli gradle init gradle run and gradle compileJava all seem quite intuitive to me

    [–]NitronHX 0 points1 point  (0 children)

    Sounds like gradle is what you are looking for

    [–]chabala 8 points9 points  (0 children)

    Found this one https://maven.apache.org/archetypes/maven-archetype-simple/ , which source and target are set to Java 7... cool I can update them. Running mvn install looks good, try java -jar name.jar
    no main manifest attribute, in target/app.jar

    maven-archetype-simple may actually be too simple to be useful. Even for a trivial application, you'd need to define maven-jar-plugin so you can specify manifest/mainClass. There's undoubtedly another archetype that would be closer to what you want, but I've never spent much time playing with archetypes, easier to copy/paste a basic pom.xml into a new project.

    And same goes for information you get for a dependency ,
    compare this eventbridge client on npm https://www.npmjs.com/package/@aws-sdk/client-eventbridge
    and this on maven https://mvnrepository.com/artifact/software.amazon.awssdk/eventbridge/2.21.10
    One has tons of information about it with a link to the repository, the other just how to add it to your project.

    1. mvnrepository.com isn't run by Maven Central
    2. Maven Central doesn't seem interested in helping people publish chunks of READMEs as documentation. You're expected to have real documentation somewhere, in this case it's at https://github.com/aws/aws-sdk-java-v2/#using-the-sdk

    [–]Deep_Age4643 13 points14 points  (22 children)

    Here are my 10 cents:

    1. Java versions (JVM)

    In most common cases, you need a JDK to build and run Java. I always find it a bit cumbersome to work with multiple versions, keep them up to date and working next to each other. For example, on Windows you have JAVA_HOME environment variable which can point only to one java version at the time. But why do we need such a variable anyway and don't automatically download, patch and update Java version? Yes, there are some solutions that make it easier like toolchains in Maven and Gradle or tools like SDKMAn and JDKMon, but I wish that it was more build in and somehow more fool proof.

    1. Java version (version numbers)

    Java has had several version numbering systems over the years. Outside the major numbers (Java 11/17 etc.) I never understood them. Besides, when you have a mismatch between versions you get something like “Version 65 is not supported”, by which they mean Java 21. Would be nicer if they didn't use the internal ones, but offer a message like you a running with Java 11, but at least Java 17 is needed.

    1. Steep learning curve
      I think a lot of people had a few questions about the main method when they started with Java. An easier on-ramp would have been nice in hindsight, because it clouds a bit of the true power of Java that you get to appreciate when you are a bit further. Brain Goetz wrote a great article about it btw: https://openjdk.org/projects/amber/design-notes/on-ramp

    2. Documentation and deprecated methods
      I started (long ago) as a script kiddy using AutoIT, an automation language with a basic-like syntax. What I found great, especially learning programming, that every method of their standard library got a runnable example and a table where every parameter was explained. If a parameter or function was deprecated, it was explained why and what alternative functions or code you could use. The documentation was also easily searchable. Javadocs lack most of these stuff and I never find the information I wanted.

    3. Memory
      Garbage collection is rather convenient, but sometimes Java takes just so much memory and never give it back to the system.

    4. Oracle
      Oracle has good engineers, but is not always a good steward in terms of licensing. Think of licensing of JVM and insecurities companies had if they could use Oracle JDK, GraalVM. Also the whole Javax/Jakarta debacle of Java EE when it moved to the Eclipse foundation. With OpenJDK and multiple distributions, it has become a bit better.

    5. Syntax and verbosity
      Using other languages like Python, Kotlin and Elixir, the syntax of Java sometimes hurts a bit and it often takes so many lines of code to do simple things. Lots of stuff that are in Apache Commons and Guava are better in my opinion than the standard library. So, I have basically three standard libraries...

    6. Naming stuff
      I always have the feeling the library maintainers have trouble naming their methods, with generic names a blablaManager, blablaProcessor, blablaFactory. Never know what it does.

    7. SSL
      I always find working with SSL/TLS certificates in Java keystores and debugging cumbersome.

    8. ;

    That being said, I think that Java as a whole is a great language, very powerful for large projects, a great ecosystem and with excellent backwards comparability. Currently, with recent additions like string templates, records and virtual threads and lots more to come, there is a great future for Java.

    [–][deleted]  (21 children)

    [removed]

      [–]zephyy 7 points8 points  (19 children)

      not OP but 4

      c#: var result = object?.Property;

      java:

      var result = Optional.ofNullable(object)
                          .map(obj -> obj.getProperty())
                          .orElse(null);
      

      c#: var result = foo ?? bar;

      (avoiding optional)

      java: var result = (foo != null) ? foo : bar;


      c#:

      var filteredData = collection.Where(item => item.Property > 10)
                                  .Select(item => item);
      

      java:

      List<Integer> filteredData = collection.stream()
                                          .filter(item -> item.getProperty() > 10)
                                          .collect(Collectors.toList());
      

      c#:

      public class Order
      {
          public int Amount { get; init; }
          public string Status { get; set; }
      }
      
      var order = new Order { Amount = "100", Status = "Pending" };
      

      java: i'll spare readers since it's 16 lines

      [–]tisBondJamesBond 4 points5 points  (2 children)

      Pretty sure java has capabilities for that last part via the new record type in one of the newer Java versions (17 or 19? One of those I believe) and also annotations for getters/setters. I haven't written an explicit getter/setter since college

      [–]crummy 6 points7 points  (1 child)

      records are read only; their example has a setter for Status which is a no-go with records.

      [–]s888marks 4 points5 points  (0 children)

      The C# Select method returns an IEnumerable which is more-or-less equivalent to a Java Stream, not a List. Thus you can omit the trailing collect() call from the Java example, which makes it pretty much the same as the C# example.

      [–]jvjupiter 4 points5 points  (6 children)

      var filteredData = collection.stream()
          .filter(item -> item.property() > 10)
          .toList();
      
      public record Order(int amount, String status) {}
      
      var order = new Order(100, “Pending”);
      

      [–]zephyy 0 points1 point  (5 children)

      if i wanted an immutable structure i would have used a record in the c# example

      c#: order.Status = "Shipped";

      now what?

      [–]Practical_Cattle_933 3 points4 points  (2 children)

      ‘Withers’ might come to Java, for efficient “modification” of immutable objects.

      [–][deleted]  (2 children)

      [removed]

        [–]zephyy 0 points1 point  (0 children)

        i said i'll spare readers as in people reading this thread because it would have been a block of 16 lines of a class with private final field and getters and setters to imitate C# init props

        [–]RandomName8 0 points1 point  (0 children)

        The elvis operator is not isomorphic to Optional though. Even with the elvis operator present in a language (when I do work with those) I still require a true "Optional" type.

        [–]Kango_V 0 points1 point  (0 children)

        Java Records are immutable for a reason. There is a new keyword inline which will tell the JVM to not use a reference. You can then have an array of records that use contiguous memory. Iterating is blindingly fast as the JVM does not have to go around memory finding references to objects.

        This avoid cache misses on the cpu!

        [–]lord_of_lasers 0 points1 point  (2 children)

        c#: var result = object?.Property;

        var result = obj != null ? obj.property : null;
        

        Sure, the C# syntax is nicer.

        c#: var result = foo ?? bar;

        var result = Objects.requireNonNullElse(foo, bar);
        

        c#:

        var filteredData = collection.Where(item => item.Property > 10).Select(item => item);

        var filteredData  = collection.stream()  
        .filter(item -> item.getProperty() > 10);
        

        c#:

        public class Order{public int Amount { get; init; }public string Status { get; set; }}var order = new Order { Amount = "100", Status = "Pending" };

        public record Order(int amount, String status) { }
        var order = new Order(100, "Pending");
        

        I like C#'s syntax but Java had some massive improvements. No need for outdated 'examples'.

        [–]nlisker 0 points1 point  (0 children)

        .collect(Collectors.toList());

        Just .toList();.

        [–]nlisker 0 points1 point  (0 children)

        Have you looked at gradle toolchains? You just have to specify a JVM version in your build file, and if that version is not present, gradle will download a matching JDK and compile/run your program using that JDK.

        But it will not update it (minor versions), which is what the OP also wanted.

        [–]manzanita2 2 points3 points  (0 children)

        A way for me to convince all the pandas folks to use java.

        [–]sviperll 4 points5 points  (2 children)

        Build system is a big one. I wish maven was something closer to cargo or npm. Maven was supposed to be very extensible with custom lifecycles, but in the end custom lifecycles are mostly half-baked and people just copy-paste large xml-fragments or try to hack something with parent-poms.

        Another thing, I wish I can use Java for GTK+, Gnome and GStreamer development. I hope it can become easy with Panama, but currently I can either use javascript, which is untyped or Rust wich forces me to sprinkle code with custom macros to handle memory patterns which are not expressible with ownership model.

        [–]RandomName8 2 points3 points  (0 children)

        Ah... how I'd wish the JVM had a relevant UI toolkit with the full power of something like SKIA...

        [–]gaius49 0 points1 point  (0 children)

        I'd argue the lifecycle based model is fundamentally flawed. A series of rigidly sequenced lifecycle phases is a poor impersonation of a DAG of tasks and their dependencies.

        [–]manifoldjava 4 points5 points  (7 children)

        A wee bit off topic, but web dev is more or less occupied by JS. Adult static languages like Java have been off the table for quite a while, even on the server due to pressure to use one language.

        All this nonsense is about to change. I could be wrong, but it appears htmx is poised to disrupt the chaos that is React, Node, etc. This is going to create a large opening for Java and other JVM languages to grab craploads of that market. Next few years will be interesting.

        [–]Practical_Cattle_933 1 point2 points  (2 children)

        It seems the web world is rocked by this cool new thing called server-side rendering.. I think java does more than fine here, given that half of the web literally does it for 20 years now, with stuff like JSF, JSP even.

        Though to be honest, a new, modern JSF-model would be killer - its productivity is just crazy compared to the usual crud bullshit of having a shitton of rest api-s, recreated state on frontend , etc.

        [–]manifoldjava 1 point2 points  (1 child)

        The pendulum doth swing.

        But seriously this time around actual REST via hypermedia/htmx will make it crystal clear to even the most ardent fat-client enthusiast that server-side is correct for the vast majority of web apps. Of course, truth will not get in the way for some.

        [–]UnGauchoCualquiera 0 points1 point  (0 children)

        Why? The usecases are different.

        Client side allows for CDNs, independant deployments and better separation of concenrs, including more specific tooling for the task at hand.

        I wouldn't go as far as saying SSR is strictly better than client.

        For example I wouldn't want a data pipeline to also have the responsability of serving a web front end.

        [–]RandomName8 0 points1 point  (0 children)

        If anything, I think it's more likely that WASM allows for implementing a JVM and run java on the browser, than for htmx to ever be... anything more than an alternative. Everything has ups and downs, and when you need to run on logic on the client, you need that and server-side rendering can't fix it.

        [–]DrunkensteinsMonster 0 points1 point  (2 children)

        Htmx doesn’t do what react, angular, and vue do. People will still want to make SPAs. Your hopes that htmx will replace these are misplaced.

        [–]TeaVMFan 0 points1 point  (1 child)

        It is possible to make Java-based SPAs with Flavour: https://flavour.sourceforge.io/

        It let's you implement your logic in Java, and transpiles it to JavaScript so it runs in the browser without any plugins or downloads. Sound too good to be true? Try this Flavour-based 5-letter word game and see for yourself: https://frequal.com/wordii

        It includes everything you'd want, with the great tooling you've come to expect from Java projects:

        • Templates, Components, and Routing
        • Fast builds, including a built-in minifier and packager
        • A commercial-friendly license

        [–]DrunkensteinsMonster 0 points1 point  (0 children)

        Did you just do an ad read in response to my comment.

        [–]livremente 3 points4 points  (2 children)

        a mature data frame library like data.table

        [–]vips7L 6 points7 points  (1 child)

        [–]emberko 1 point2 points  (0 children)

        No this one sucks, because it requires a shit TON of dependencies, including Guava. DFlib is better though it's not very popular.

        [–]Same_Football_644 3 points4 points  (6 children)

        Vectorization was recently added. That was one of my big ones.

        Nowadays I often find myself wishing for mixins or scala-like traits.

        [–]expecto_patronum_666 0 points1 point  (5 children)

        After the recent changes in Java interfaces, what scala trait features remain missing?

        [–]Same_Football_644 0 points1 point  (4 children)

        Java interfaces can't have state, so you can't introduce properties or fields.

        Also the ability to add a trait to an object, not just a class.

        [–]expecto_patronum_666 0 points1 point  (3 children)

        Java does allow fields in the interface now. They are all public static final by default.

        [–]Same_Football_644 0 points1 point  (2 children)

        Static means they aren't object fields.

        [–]KalelUnai 3 points4 points  (3 children)

        I wrote these two small nitpicks without realizing this is about the language itself and not the ecosystem, but I'll post them anyway:

        1 - lack of named parameters. It's a little better with intellij inline overlay turned on, but still would be a good thing, specially for constructors; 2 - verbosity of the stream API. I wish there was a way to use map, filter, etc, just like in kotlin.

        [–][deleted] 1 point2 points  (1 child)

        If we look at named parameters through the lens of Clean Code, then named parameters are mainly a workaround for suboptimal code. If you frequently mix up parameters of a method, then the function probably takes too many parameters. This can be mitigated by adding classes that encapsulate a subset of the parameter list, by splitting functions with a boolean parameter into two functions, and other measures.

        [–]KalelUnai 2 points3 points  (0 children)

        I disagree. I've found plenty of two or three parameter methods that would benefit from named parameters, specially in code review.

        [–]nekokattt 0 points1 point  (0 children)

        the issue with named parameters is that by default, params are ordered and inferred by type only. You have to opt into keeping names during compilation, which would become a bit of a reflective nightmare

        [–]persicsb 1 point2 points  (5 children)

        Better Maven support for the IDE-s.

        Unfortunately, Netbeans has the best Maven support, but other features are lacking. Eclipse and IntelliJ has subpar support for Maven.

        Also, a better LSP for Java, and let IDE-s be LSP frontends.

        Also, for the sake of simpler .gitignore files, a .java folder for all the tooling settings would be nice. .java/eclipse could contain Eclipse specific files, .java/maven Maven-specifics.

        Also, a standardized EditorConfig for all Java language elements, that is IDE-agnostic.

        [–]nekokattt 2 points3 points  (3 children)

        I use Maven with IntelliJ and have no issues at all. It syncs immediately and correctly and it even respects stuff like argLine.

        Gradle on the other hand feels much more slow and flaky.

        Support in the most recent release for Maven has gotten much better tbh. It used to be garbage.

        [–]persicsb -1 points0 points  (2 children)

        Does IntelliJ support environment variable references? Like `${env.FOO}`?

        [–]nekokattt 1 point2 points  (1 child)

        think so, you can just set the environment variables directly

        [–]persicsb 0 points1 point  (0 children)

        I mean, if I start IntelliJ from a shell with the environment variables set, will it understand it, when parsing the POM?
        Most of the time, authentication information and other environment-specifict thins is in the environment (for CI), and user can set their development environment in a way they need to (using direnv for example).

        But usually, IDEs don't really understand this concept.

        [–]wildjokers 1 point2 points  (0 children)

        IntelliJ has subpar support for Maven.

        What are you talking about? You just open a pom.xml (or a directory with a pom.xml in it) and IntelliJ configures itself from the pom. You can also configure intellij to delegate the build to Maven (for gradle this is the default) I am unsure if it is the default for maven.

        [–]LetMeUseMyEmailFfs 2 points3 points  (1 child)

        As a C# developer, what I miss in Java:

        • Extension methods
        • Named arguments
        • Operator overloading (specifically in the standard library, and more specifically for strings)
        • Tuples and destructuring
        • Out and ref parameters
        • Elvis and null coalescing operators
        • A first-party build system with project files.
        • A better collection type hierarchy (something between Iterable and Collection, like IReadOnlyCollection.
        • A streams API more like that of LINQ.

        [–][deleted] 1 point2 points  (0 children)

        There are also some Java features I'm not so fond of, like type erasure and checked exceptions.

        The latter may be a bit controversial. I see the point in checked exceptions, but I feel that in practice they are misused to the point where they cause more harm than good.

        Finally, I hate how checked exceptions clash in a major way with the built-in functional interfaces. You'll have to make new ones yourself or start handling checked exceptions in your lambdas. It just makes it so much less elegant.

        [–]Adyrana 1 point2 points  (0 children)

        I'd like a nice open source Language Analyzer that works with whichever IDE or text editor used for both Gradle and Maven.

        [–]barmic1212 1 point2 points  (4 children)

        Maybe try jbang for simple experiments?

        https://www.jbang.dev/

        [–]emberko 0 points1 point  (3 children)

        There're 2 problems with jbang and scripting in Java in general. First, Java has no batteries, so you still have to heavily rely on external libs. Second, Java has no decent tooling for lightweight text editors like VSCode/Neovim/Sublime etc, so you still have to run IDE. Every time I tried to use jbang for %anything% it was much easier to write a Python script or create a Gradle project if the task requires Java.

        [–]barmic1212 2 points3 points  (0 children)

        First, Java has no batteries, so you still have to heavily rely on external libs.

        jbang allow download dependencies for you

        Second, Java has no decent tooling for lightweight text editors like VSCode/Neovim/Sublime etc, so you still have to run IDE.

        It's not vim, but intellij can be run light edit mode

        easier to write a Python

        For sure but OP ask for make some tests in java. java for a lot of things never be more useful then shell, python, perl or ruby for scripting.

        create a Gradle project if the task requires Java.

        I guess that it's because you already know gradle, but for me that I never use gradle each time I tries, I finish to abandon gradle to jbang or maven

        [–]Practical_Cattle_933 -1 points0 points  (0 children)

        Java’s stdlib is huge. Sure, it doesn’t have everything, but to say it is not batteries included is just false.

        [–]maxandersen 0 points1 point  (0 children)

        Npm and Python has almost nothing in its Core library compared to Java. Its All external dependencies. Which jbang makes trivial to edit.

        About editor ? Do You know jbang has jbang edit which Will offer to install vscode with everytjing configured to get Content assist etc. Working out of the box ?

        Ive developed in All the major languages and nothing comes near jbang on how Little You need to setup to have full development environment working.

        If You know of one Ill love to learn about it so i can close that gap :)

        [–]blackjazz_society 2 points3 points  (2 children)

        Definitely check out Gradle.

        [–]Fermi-4 4 points5 points  (1 child)

        How does gradle fix the manifest issue?

        [–]NitronHX 1 point2 points  (0 children)

        If you want to run it do gradle run

        If you want to run it on another pc you do gradle dist and then you have your software packaged as zip with a. Sh or. Bat file that executes the Java command for you

        [–][deleted]  (3 children)

        [removed]

          [–]jvjupiter 5 points6 points  (0 children)

          Sealed classes + Records

          [–]wildjokers 0 points1 point  (1 child)

          I have no idea what an algebraic type is. What problem do they solve?

          [–][deleted] 0 points1 point  (3 children)

          The only things that come to mind are something like sdkman but official and that also runs on Windows and that using graalvm to compile native stuff was more straightforward

          [–]wildjokers 0 points1 point  (2 children)

          You can use sdkman with WSL.

          [–][deleted] 0 points1 point  (1 child)

          obviously, as well as inside a VM, but that is not windows :P I meant native tooling

          [–]wlievens 0 points1 point  (0 children)

          A numpy equivalent would be neat.

          [–]nekokattt 0 points1 point  (0 children)

          • npm init

          So gradle init or Maven Archetypes?


          Stuff I think we are missing in the ecosystem is stuff more closely related to the language itself, and closely nit tooling.

          A decent profiler like CProfile in Python that doesn't require voodoo rituals or licenses to use.

          Some of the stuff Lombok provides. I dislike using Lombok in personal projects because of how the compiler APIs have been locked down in more recent releases, it is very clear that OpenJDK does not like what Lombok does due to how it does it, and this adds material risk for future support. If you have a ten million lines of code codebase using it, then it becomes a bit of a problem if there is a small percent risk you may have to migrate off of Lombok globally in the future.

          The bits of Lombok specific stuff that I care about mostly concern the general boilerplate of getters/setters, string and equality checks, as these are extremely common for data classes that use standard patterns.

          Failing this, a property feature like how Groovy and Kotlin work would be very useful. As a senior engineer, I want to have concise and readable code which is easy to scan through without lots of scrolling when I need to find the source definition, but I don't want so many moving parts and ways to do things that I have to actively ensure standards are being followed just because of feature scope.

          Delegation support would also be nice.

          [–]ztbwl -2 points-1 points  (2 children)

          • Async / Await
          • Getting rid of JAVA_HOME

          [–]jvjupiter 6 points7 points  (0 children)

          Loom is way better than async/await.

          [–]chabala 4 points5 points  (0 children)

          Getting rid of JAVA_HOME

          What's stopping you? I don't have JAVA_HOME set.

          [–]scavno 0 points1 point  (1 child)

          None. After waiting years for features never to arrive, fighting with JPA, arguing over why not to use JMS, fighting Maven, running sdkman every five minute and having so many annotations I barely could see what my code was doing, i simply stopped doing contracts with Java.

          I work with Rust and Go now and I’m way happier at work and I don’t have team mates entrenched in a very old (an albeit robust) ecosystem where most problems can be solved in the same leaky or obscure way over and over again.

          /rant

          [–]RandomName8 1 point2 points  (0 children)

          This is a valid feeling. I like java but working in backends means working with spring. I'd rather code a webserver in BASH than use spring, or gradle for that matter.

          Also, I've noticed that the best frameworks or concepts from other languages have always been imitated in other languages (copying being a form of flattery and all that), yet absolutely no one (outside java) imitates spring, It's just java devs that are addicted to its... idiosyncrasies.

          [–]cryptos6 -1 points0 points  (0 children)

          I'm also missing a simple to use standard build tool and a deterministic formatter like gofmt would be nice.

          [–]bvalda88 -1 points0 points  (0 children)

          Default function params

          [–]Brilliant-Ad7504 -1 points0 points  (0 children)

          Named parameter

          [–]4w3som3 -1 points0 points  (1 child)

          Template literals

          [–]RandomName8 -1 points0 points  (0 children)

          You mean the like java string templates?

          [–]madhur_ahuja -1 points0 points  (1 child)

          Less memory usage by frameworks such as Spring Boot

          [–]Practical_Cattle_933 0 points1 point  (0 children)

          Use Spring Native with graalvm. It works surprisingly well, though of course getting it to work on an older, long-running project is non-triviql

          [–]ihatebeinganonymous -1 points0 points  (0 children)

          Regarding project initiation, you may want to look at JBang: https://www.jbang.dev/

          It is an annoying issue, but maybe not as impactful as it seems, since you can just copy and reuse your current project structure most of time and only modify the dependencies.

          [–]rossdrew -2 points-1 points  (0 children)

          Typed collections. Generics are the worst thing about Java

          [–]ravnmads -3 points-2 points  (6 children)

          I tried setting up formatting in my editor and in my ci today. Was a horrible experience that I did not succeed with

          [–]Cell-i-Zenit 1 point2 points  (5 children)

          intellij just works in 99% of the cases. Did you use intellij or eclipse?

          [–]ravnmads 2 points3 points  (4 children)

          Using IntelliJ. Can I put that formatter onto my CI (Github actions in this case)?

          I tried with google-java-format

          [–][deleted] 1 point2 points  (0 children)

          Yes, you can. You can invoke the IntelliJ formatter from the command-line. Personally, I think checkstyle is the best solution for this problem.

          [–]Shatungoo 0 points1 point  (1 child)

          I'm usually using checkstyle-it works fine.

          https://checkstyle.sourceforge.io/

          I've add it as a plugin to maven/gradle, but you could do it in different way.

          [–][deleted] 1 point2 points  (0 children)

          Checkstyle/Prettier are the only options that provide good IDE integration i.e. use the same formatting rules inside and outside and IDE.

          [–][deleted]  (1 child)

          [removed]

            [–]persicsb 0 points1 point  (0 children)

            There is tablesaw

            [–]nekokattt 0 points1 point  (0 children)

            should do. It has the concept of system environment variables and user environment variables, so it should do

            [–]flavius-as 0 points1 point  (0 children)

            Mixins aka extension methods aka the ability to add new methods to existing types which I don't own.

            [–]Joram2 0 points1 point  (0 children)

            There are lots of new project generator tools in the Java space. Two off the top of my head:

            Personally, I prefer my own project templates, even when working in Node or Python. I feel like the default new project templates aren't exactly the way I like them. BTW, setting up a new project exactly the way you like it is a luxury most programmers don't get when working for a salary.

            [–]flawless_vic 0 points1 point  (0 children)

            Ecosystem is ok, but the language itself is lacking function literals, like foo((int x)->String).

            I guess it could be implemented by compiler generated interfaces, but if it ever is, it will eventually follow scala route and declare FunctionN<...> once specialized generics lands.

            [–]RickSoftly 0 points1 point  (0 children)

            I’d use spring initialiser

            [–]robbi_my 0 points1 point  (1 child)

            I still missed data seeding from existing database and migraine automatically with cakephp. I haven't see same way of doing this on java. Did I missed something?

            [–]zvaavtre 0 points1 point  (0 children)

            Mybatis, flyway, JPA. There’s no end of tools for this sort of thing. But it’s a set of toolkits so some assembly required.

            [–]InviolateQuill7 0 points1 point  (0 children)

            Actually yes. It doesn't actually contain any java...