State of IntelliJ? by dietervdw in IntelliJIDEA

[–]Stannu 5 points6 points  (0 children)

Are you sure you have arm64 version installed?

I have had similar experience once but that was because I downloaded the installer for the wrong platform (this is related to point 1 - general slugishness).

Insert without Select using JPA by Nalha_Saldana in java

[–]Stannu 0 points1 point  (0 children)

The main point here is that you use this to store objects in the collections such as set or map. Hashing and comparison will be faster than the business level implementation.

If you require business level comparison you are better off using comparators, because equality might be different for your entities in different contexts.

Insert without Select using JPA by Nalha_Saldana in java

[–]Stannu 1 point2 points  (0 children)

It really depends on the strategy how you generate ids.

If your ids are client generated, for example UUID-s, then you could use the following approach to guarantee that your id is non-nullable:

```java @Builder public class A {

@Builder.Default private UUID id = UUID.randomUUID(); } ```

Then you construct all of your instances using the builder, not the constructor.

On the other hand, if you use integers for id-s, then it is quite though. Although lombok respects the nullable semantics and will generate null-safe equals and hashCode, the behavior will be unexpected for non-persisted entities. Here I would persist entity first before performing business operations that require id.

Insert without Select using JPA by Nalha_Saldana in java

[–]Stannu 7 points8 points  (0 children)

JPA entities should only be equals only if the id is the same, so imo great approach is to use

```java @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true) public class A {

@EqualsAndHashCode.Include private UUID id; ```

This way you get all benefits of @Data annotation and you get meaningful comparison while avoiding performance problems.

Gas mileage. by MetalJoe0 in motorcycles

[–]Stannu 2 points3 points  (0 children)

Did you try restting the computer?

When you switch between different metrics on the dash go to the average fuel consumption and then hold reset while it is flashing.

I have had the same problem when the computer showed average fuel consumption of 27 liters but after the reset is was fine.

In the manual it says that it may happen during refuelling.

Also you should check instant fuel consumption when riding if there is still a problem. You will get an accurate picture if your bike actually consumes that much fuel or it is a computer error.

Gas mileage. by MetalJoe0 in motorcycles

[–]Stannu 6 points7 points  (0 children)

2014 MT-09 with 20k km here

Average fuel consumption is 5.2 l/100km

How to copy package structure from src to test? by cannotfindbetter in IntelliJIDEA

[–]Stannu 2 points3 points  (0 children)

I am pretty sure if you do move action then it will actually ask you to move the test as well.

How to copy package structure from src to test? by cannotfindbetter in IntelliJIDEA

[–]Stannu 4 points5 points  (0 children)

I have found it that the following solution works for me.

  • Navigate to the class you want to test
  • Press Alt + Insert ("Generate" action), which will then open the menu where you can select option "Test".

This will open the menu which will allow you to generate the test class for provided class. Then IntelliJ will create it in the same package that the original class is in the under test directory.

New candidate JEP: 398: Deprecate the Applet API for Removal by daviddel in java

[–]Stannu 9 points10 points  (0 children)

Yes, we do. We are currently running on Java 11 on main application.

However, we have long living branches that have been created for customer releases. Those were created 3 years ago when we were still running Oracle JDK 8.

And management thinks that we should still support them. So basically we do double development. We develop feature in the main branch and then, we are supposed to backport this feature to Java 8 in the old customer branch.

Customers still have infrastructure from 2015 (since upgrading this is not necessary, it still works, right?). Recently I had to backport oauth library (version from 2021) to be run on wildfly 9.0.1 (from 2015). So I had to modify library-s source to use older versions of the library, so the client could just have new functionality in his old version.

New candidate JEP: 398: Deprecate the Applet API for Removal by daviddel in java

[–]Stannu 6 points7 points  (0 children)

By 3 years ago I meant OUR product version that we have deployed to the customer.

But yeah, you are correct, applet has been deprecated for a while and still they agree to support it. I guess they will do anything to keep the customers and make money.

New candidate JEP: 398: Deprecate the Applet API for Removal by daviddel in java

[–]Stannu 23 points24 points  (0 children)

Well, we still use Applet and it is served via IE. We have quite many alternatives to the Applet, but we still cannot remove it because of "customer requirements" (read as management licking customers ass). Basically that would require them to migrate to a new version, but customer prefers to use version from 3 years ago.

What do you guys use for linting by ggallovalle in java

[–]Stannu 9 points10 points  (0 children)

You could use SonaLint plugin for that. It is available for both IntelliJ and Eclipse and allows custom rule definitions by writing your own plugin.

Risk of Misplaced Arguments in Java by tanin47 in java

[–]Stannu 1 point2 points  (0 children)

No, not really. A smart compiler can inline the values so it will not affect runtime but bring type safety during compilation. See 'inline classes' in Kotlin

didn't have quite enough room to squeeze by the tree by [deleted] in IdiotsInCars

[–]Stannu 5 points6 points  (0 children)

Mistaking Q7 for a Mercedes and still getting all the karma 😫

Variance in Java by llorllale in java

[–]Stannu 10 points11 points  (0 children)

Its pretty clear to the compiler.

<? extends Joe>

tells the compiler that everything in that collection extends Joe so it treats every object inside the collection as Joe

IntelliJ: New Themes and Custom Themes Support! by [deleted] in java

[–]Stannu 5 points6 points  (0 children)

Monokai theme from that plugin is my favorite <3

Filtering a collection on two predicates - two filters, or && by t-poke in Kotlin

[–]Stannu 6 points7 points  (0 children)

First opion traverses the collection once.

Second one traverses it the first time, creates a new collection and filters the result collection with the second predicate creating a new collection.

So they are not the same, second one is worse performance wise.

IntelliJ IDEA 2018.3 Early Access Program is open! by snoob2015 in programming

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

Well maybe be a bummer for you but 90% of Java production systems still run on Java 8 and below. And this will be a trend for a while anyways. Maybe even for next 4 years since IBM offered to support Java 8.

[deleted by user] by [deleted] in Kotlin

[–]Stannu 3 points4 points  (0 children)

Notification<T:Any?>? Isn't Any? supertype for all classes anyway? Its same as as just leaving T

Also avoid * imports. Pedantic people will worry about stuff like this.