Tagir Valeev's Avatar

Tagir Valeev

@tagir-valeev.bsky.social

Work at JetBrains. Java Champion. Check my Java book: https://mng.bz/671p

324 Followers  |  29 Following  |  46 Posts  |  Joined: 24.01.2025  |  1.7394

Latest posts by tagir-valeev.bsky.social on Bluesky

Post image Post image

I like how @briangoetz.bsky.social uses type nullability markers ? and ! in an unrelated discussion without even explaining them, like if it's already well-known thing that exists in the language for a long time ๐Ÿ™‚

04.08.2025 20:40 โ€” ๐Ÿ‘ 4    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
/*
     * Package private constructor. Trailing Void argument is there for
     * disambiguating it against other (public) constructors.
     */
    String(AbstractStringBuilder asb, Void sig)

/* * Package private constructor. Trailing Void argument is there for * disambiguating it against other (public) constructors. */ String(AbstractStringBuilder asb, Void sig)

As named constructors are not possible in #Java, some non-public constructors in OpenJDK contain bogus parameter, just to differentiate them from other constructors.

31.07.2025 11:14 โ€” ๐Ÿ‘ 9    ๐Ÿ” 3    ๐Ÿ’ฌ 2    ๐Ÿ“Œ 1
Post image

โ€œSudo, Make Me a Sandwich! โ€“ Live Coding With Agentic AI in IntelliJ IDEAโ€ by @antonarhipov.bsky.social is now live: youtu.be/1cx8vDJYi74
Watch Junie, JetBrainsโ€™ coding agent, in action and see how far AI can go in dev workflows.
#IntelliJIDEAConf

29.07.2025 10:01 โ€” ๐Ÿ‘ 13    ๐Ÿ” 3    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

I hope you'll enjoy it! Though a professional like you likely knows already more than half of the things I'm writing about :-)

16.07.2025 09:26 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image

I've wanted to buy "100 Java Mistakes..." by @tagir-valeev.bsky.social for a while. Done ๐Ÿ‘. Tagir knows so much about Java, and I'm sure I've made many of these mistakes. I'm looking forward to reading this now. ๐Ÿ™

12.07.2025 20:49 โ€” ๐Ÿ‘ 6    ๐Ÿ” 2    ๐Ÿ’ฌ 2    ๐Ÿ“Œ 0
Post image

Using AI slows down experienced developers?
metr.org/blog/2025-07...

11.07.2025 09:01 โ€” ๐Ÿ‘ 3    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 1

The nice thing is that it fixed (and fixed correctly) the real bug in the test, despite I said in the prompt that the test is correct and you need only to write an implementation.

09.07.2025 16:34 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Asked JetBrains Junie to implement Stream.takeWhile support in our dataflow analysis. It implemented it, and the tests I wrote beforehand are passed. However, it just reused the Stream.filter implementation. Apparently, I needed better tests. Still, it's a good start, not complete garbage.

09.07.2025 16:33 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

If you have a CPU-intensive computation which moves/copies data between HashSets a lot, it may make sense to enumerate all your objects (map them to consecutive integers) and move to BitSets instead, mapping back at the end. They are waaaay faster.

04.07.2025 16:47 โ€” ๐Ÿ‘ 4    ๐Ÿ” 1    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

I'm going to visit JVM LS this year! See ya there!

02.07.2025 10:17 โ€” ๐Ÿ‘ 4    ๐Ÿ” 1    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

One of my top 3 highlights this year thus far was being invited by the @jetbrains.com @intellijidea.com team to celebrate #30YearsOfJava. The #Java story is rooted in both ongoing technical innovation & community participation.

My thanks to @maritvandijk.bsky.social who made this all possible.

01.07.2025 14:28 โ€” ๐Ÿ‘ 13    ๐Ÿ” 4    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Preview
IntelliJ IDEA Conf 2025 | June 3-4, 2025 We invite you to join us for IntelliJ IDEA Conf 2025 and gain insights from industry leaders and experts.

#Java peers...the 2025 @intellijidea.com Conference is around the corner (June 3-4)! There's still time to register for this FREE virtual event: jb.gg/c463w8

Hear from host @maritvandijk.bsky.social and me as we kick things off to celebrate 30 YEARS OF JAVA!

29.05.2025 14:52 โ€” ๐Ÿ‘ 30    ๐Ÿ” 10    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image

TIL: In #Java format strings, you can specify indentation to a single percent character.

26.05.2025 09:40 โ€” ๐Ÿ‘ 5    ๐Ÿ” 2    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
30 Years of Java
YouTube video by IntelliJ IDEA, a JetBrains IDE 30 Years of Java

Kinda cool #Java30Years #JetBrains www.youtube.com/watch?v=kHyb...

23.05.2025 12:29 โ€” ๐Ÿ‘ 5    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image

Here's how the analytics for a single flaky test looks like inside the IntelliJ project.

22.05.2025 08:54 โ€” ๐Ÿ‘ 3    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Schokolade der DB auf dem Buch '100 Java Mistakes and How to Avoid Them' von Tagir Valeev auf dem ICE Tisch.

Schokolade der DB auf dem Buch '100 Java Mistakes and How to Avoid Them' von Tagir Valeev auf dem ICE Tisch.

Manchmal sind es die kleinen Dinge, die einem das Leben versรผรŸen oder auch 100.
@bahn.de @tagir-valeev.bsky.social

19.05.2025 07:12 โ€” ๐Ÿ‘ 2    ๐Ÿ” 1    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Video thumbnail

๐Ÿค— Mellum is now open source on @hf.co!

Itโ€™s a focal model that is small, efficient, and made for one thing: code completion.

โš™๏ธ Trained from scratch by JetBrains.
๐ŸŒฑ First in a growing family of dev-focused LLMs.

๐Ÿ”— jb.gg/hi_mellum

30.04.2025 12:43 โ€” ๐Ÿ‘ 63    ๐Ÿ” 17    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 3
Post image

And it prints 'From var'. However, you can remove the variable declaration, and it will resolve to a class and print 'From class'. There's no ambiguity, as an instance-bound method reference has a priority over a statically bound one.

15.04.2025 09:48 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image

You can try something simpler, e.g.

void main() {
class C {
static void run() {
System.out.println("From class");
}
}
Runnable C = () -> System.out.println("From var");

Runnable r = C::run;

rโ€‹.run();
}

IDE resolves C properly to a variable.

15.04.2025 09:48 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

One of the few places where both class name and variable name can appear is the method reference qualifier. In this case, first it's assumed to be an expression (variable reference), and if it doesn't work, then there's an attempt to resolve a class. If the variable works, we don't try a class.

15.04.2025 09:48 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

The correct answer is counter-intuitively, Outer2โ€‹.foo. Normally, classes and variables have separate namespaces in Java, so importing class and importing variable (static field) with the same name does not produce an ambiguous import.

15.04.2025 09:48 โ€” ๐Ÿ‘ 3    ๐Ÿ” 1    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

Crowdsourcing compiler fuzzy-testing.

15.04.2025 09:35 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Ok, here's my solution. Full of warnings, of course, but who cares about warnings?

void main() {
O<O<O>> O = O<O>::<O>O;
}

interface O<T> {
void use(O c);

default <C> void O() {
}
}

15.04.2025 09:35 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Not sure. You'll get extra points for such a solution :-D

14.04.2025 07:40 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Not necessarily. It works either way.

14.04.2025 07:25 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Btw ChatGPT 4o cannot solve it for me (using the post above as the prompt). You have a chance to be smarter than AI :-)

14.04.2025 07:24 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Provide the declaration of the O type, so this statement could be a valid #Java statement:

O<O<O>> O = O<O>::<O>O;

14.04.2025 07:22 โ€” ๐Ÿ‘ 5    ๐Ÿ” 1    ๐Ÿ’ฌ 4    ๐Ÿ“Œ 1
Post image

Well, I didn't fall for Mistake #11 from @tagir-valeev.bsky.social's book, but quite something similar:
Jackson Objects are both mutable AND return the updated self. I took it for being a copy-then-modify-Operation and used the original value elsewhere - which was modified, too. ๐Ÿ˜ฌ

#java #mistakes

12.04.2025 12:48 โ€” ๐Ÿ‘ 13    ๐Ÿ” 2    ๐Ÿ’ฌ 3    ๐Ÿ“Œ 0
Post image

What is the output of the following Java code?
A: Outer.Innerโ€‹.foo
B: Outer2โ€‹.foo
C: Compilation error
D: Runtime exception
(No idea if it's possible to post a poll here)

11.04.2025 14:45 โ€” ๐Ÿ‘ 3    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 1
Post image Post image

Two lines of code eat too much of time in a user-supplied CPU profile. These lines exist for ages. It's not so clear why they were added. Let's just remove them๐Ÿคž

09.04.2025 16:39 โ€” ๐Ÿ‘ 5    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

@tagir-valeev is following 19 prominent accounts