deebogah, yourkit can't properly correlate virtual thread events (jsp+sql+tcp write etc), are there any other options currently?
deebotrying to figure out what is actually causing 10x response times on a cold instance, and if it could be improved a bit or warmed up for service
* agnivn joined #java
* kathadris joined #java
* agnivn joined #java
[twisti]we are looking for a (cli, for CI) tool to help with our code style mess in our old java projects. we need these features: the tool should have a mode to automatically fix all found issues, the tool needs a mode to just throw errors when it would want to make any changes, and the tool obviously needs to be configurable as well as overridable per line. ideally, something that detects more than just syntax style issues like whitespace, and allows
[twisti]rules such as 'always use yoda conditions'. any suggestions i should look at ?
* Deneb joined #java
deebohave not run into a tool that would be as "standard" as prettier is for nodejs projects
ParaI've seen prettier being used for Java as well, but dunno how well it behaves.
ParaSonarQube reports is one thing as well, ArchUnit can handle some corners...but no, can't think of a single tool for all of it.
deebosonarqube requires a license post java8 or something, we had to abandon it ages ago even though it was really good
deebosonarlint is ok, not sure if it integrates to ci/cd better these days, it used to just be a custom maven/gradle plugin that errored the build if it ran into violations
MikeBuxI would look at A.I. to make the code prettier and refactor it.
deebowe want formatted code, not yassified
deebo"can you add a big pair of badonkers on IOStreamFactoryConnector.java"
MikeBuxdeebo, then the formatting tools of the ide should work with the right settings
[twisti]we have like seven different IDEs, good luck getting that to be 100% identical
deeboproblem there is that people use what they use, but for java projects there's (afaik) nothing as good as prettier to define encforced formatting styles
[twisti]shame that todays php tooling is better than java, we live in the worst timeline
* stewi joined #java
* B_fd joined #java
MikeBuxthen you need a formatter or checker in the pre commit hook
MikeBuxthe only way to ensure it is run every time somebody commits
dreamreal[twisti]: what we do is run spotless in our actual build phases *and* commit hooks - one applies, the other checks
dreamrealand spotless can be pretty aggressive about checks, don't know if it'd be aggressive enough for you but may be an option or similar to what you want, what you want might be out there in different form
MikeBux[twisti], I would recommend to use one IDE for the whole team, that way everybody knows the ide, too. Might be hard for some people, but best for avoiding issues in the furture
dreamrealew
dreamrealI don't think that's good advice
dreamrealthere's definitely WORSE advice ("everyone should use netbeans!") but ... the ide shouldn't matter
MikeBuxwell last company made me use VS-Code
dreamrealokay?
MikeBuxwhile i prefer intelliJ idea
* dreamreal is waiting
dreamrealMikeBux: I mean, that sucks for you... but the IDE shouldn't be dictated, IMO. Use build tools to normalize the team's output, period. That way someone who thinks like kent beck can use eclipse, someone who likes suffering can use vscode, someone who REALLY likes working in 2010 can use netbeans, and good coders can use idea
deeboforcing an ide on devs is like forcing dvorak on HR
dreamrealexcept HR deserves it
MikeBuxdreamreal, well actually you are right, the advice is not really good. I used Netbeans, Eclipse, and some other ide's
* agnivn joined #java
deeboat one job at a large enterprise client, they gave us laptops with no permissions to install jdk
deebogot paid for a week without being able to do anything
dreamrealMikeBux: I actually don't care which IDE someone uses - I know good coders who use each of those, the IDE is not very relevant to your work product
deebodoes spotless integrate to e.g. idea as a 'on save' action?
dreamrealdeebo: I have that problem TODAY. We actually can't access any of our corporate resources without going through a physical access chain of custody.
dreamrealdeebo: it can through the build, sure
dreamrealthere may be plugins to do it explicitly without the build
deebohmpf, i like how well prettier integrates into everything
deeboseems there's a plugin at least, but prettier plugin is first party
* dreamreal shrugs
dreamrealdo what works for you
MikeBuxwell, the worst is that the team can't commit because the code is not formatted and the devs only want to review actual code changes and not the whole formatted class
dreamrealMikeBux: that's why the build does it. You build it, you get formatted code on a consistent level.
dreamrealIf it's not formatted properly by the tool, then it wasn't compiled and should fail review right out of the gate.
MikeBuxyes
* Square3 joined #java
* waz_ joined #java
* leppard joined #java
* geenvoud joined #java
dreamrealso what formatters/linters do you guys use?
dreamrealI use spotless pretty much everywhere just out of convenience; I know it well, it suits what I need, but what do you prefer, why?
* Afroboy joined #java
* polarian joined #java
MikeBuxdreamreal, we used the one ide aproach in the last company
MikeBuxand in the one before, too
* GreenResponse joined #java
dreamrealMikeBux: so you said. Did you also enforce the code formatting across the board? (And my goodness, that sounds horrible - TWO of those companies in a row?)
MikeBuxdreamreal, yes we had to make sure the formatting rules were the same in all ides, like 2 space indent and stuff like that
MikeBuxno precommit hooks and such things
dreamrealYou need to find better employers :D
dreamrealSorry, man.
* dreamreal says that as his work is *just now* standardizing on a code formatter as part of the build: our deployment is pure hell and enforces a certain conservatism we're just fighting our way past
* rvalue- joined #java
deebowe just share an idea formatter profile and then nitpick in reviews, all nodejs projects use prettier
dreamrealdeebo: makes sense, but why not use the prettier mindset for java projects, too? I mean, that's the right way to do it, why not do it?
deebowould be nice to have ide importable rules in the project, with sql formatting too
* dreamreal bleahs
deebohavent found a good solution yet, spotless is something to look at
dreamrealMy team has people who use vi, eclipse, idea, vscode... and one guy WANTS to use netbeans. IDE profiles are nice but rather isufficient.
deebothere was also some gradle ide plugin that has generic settings to define and then it can generate it for any (most) ides
dreamrealyeah, but... why? I use joe and vi and sublime text too
dreamrealthe *central* flow for every last bit of code is the build
deebowhen does the formatting actually happen for you?
dreamrealevery compilation.
deebofor all or changed files?
dreamrealI'm not sure if spotless checks the update times. But it gets applied to all files.
dreamrealI routinely work on builds with thousands of source files; it's not a problem for us.
deeboyeah we would want changed only, i guess compile works ok since most ides just call gradle
dreamrealWhy would it matter?
deebowe try to avoid drive-by formatting/etc changes, it would balloon every change in review
dreamrealI mean, if I have files j0-999.java that are unchanged, and j1001.java that IS (not real names, obv) - those 1000 files aren't going to get diffs
dreamrealthey'll always format the same. There's no DIFF. Only the j1001.java would get changed; and that'd be part of your review ANYWAY because you changed it.
dreamrealThat INITIAL commit would be a chonker. After that, nothing.
deeboyeah that would really annoyingly break blames for a while
deebobut have to see what kind of changes it would make
dreamrealSo you have a branch for "integrate spotless/whatever into the build" and ... use it. It formats every file and ONLY formats every file. rebase. Done.
dreamrealYes, it would annoyingly break blames for a while.
dreamrealWhich is why you do it early. :D Our project dates from 2007; it's not a minor cost. But should have been done years ago.
dreamreallike I said, our environment has a certain conservatism in play.
deebocould maybe sneak it in with spring boot 4 upgrades
dreamrealYou can, BTW, set formatting for spotless; if you have IDE formatting your team likes, you can get spotless to mirror it.
dreamrealThat may help with the blame problem, and also gives you a way to change formatting incrementally should you desire that.
deebois spotless + google style for example forcing a specific formatting? or does it "allow" or "deny" a formatting for something?
dmlloydnice writeup, thanks
dreamrealPLEASE sanity-check it for me, dmlloyd
dreamrealI tried to do well, but you're the expert here
dmlloydI did, it looks good
dreamrealdeebo: you can apply it or validate it
dreamrealdmlloyd: *nod* thank you
dreamrealand well done on your part
deebobut with a valid java input formatted in multiple random ways, the output is always the same?
dmlloydthanks. with that kind of motivation, maybe I'll only wait 16 months for the next one
dreamrealdeebo: if you *apply* spotless, it will generate consistent output, yes
dreamrealdmlloyd: I tried to explain what your purpose was in writing without being judgemental about it
dmlloydyeah that bit was fine
dmlloydhonestly I feel a bit nihilistic when it comes to my blog so it's a lot more than I expected lol
dreamrealmy biggest concern there is that I don't want to be projecting AND BCN doesn't criticize if it can help it, ever
dreamrealif something's worth damning I'd rather just not write about it
[twisti]had to step out. spotless is on the list, thanks dreamreal. MikeBux: note that it is your LAST company; forcing tools on grown ass adults is a good way to have everyone who has options leave for less unpleasant leadership
dreamreal[twisti]++
nevet[twisti] now has karma of 2.
Square3I'm having problems with FunctionalInterfaces. At one place we have a "serializable suppplier" (B) converted to a functional interface A. When this whole thing is deserialized I get a ClassCastException from SerializedLamba to A. If I manually create a `record C(B supplier) implements A { get() {..} }` things work.
* kcomhnall joined #java
Square3By "converted" I mean A is inferred by a method reference to a no-arg method `anInstance::noArgMethod`
* metalmaniac joined #java
dreamrealI'd want to see an actual test case
* xeno joined #java
* jamezp joined #java
* meyou joined #java
* ferdna joined #java
Square3I'll see if I can produce one. Worrisome thing is that seems a bit random.