• cheeser
  • ernimril
  • joed
  • kinabalu
  • lunk
  • ojacobson
  • r0bby
  • ThaDon
  • ricky_clarkson
  • topriddy

« 2021-09-15


2021-09-17 »

Nick Message Date
Bebef [Bebef!] has joined #java [12:17]
The_Blode [The_Blode!~Blode@user/the-blode/x-7164444] has joined #java [12:37]
Beastie [Beastie!~lcu@user/thebeastie] has joined #java [12:38]
upsala [upsala!~zcb@] has joined #java [12:46]
sagax [sagax!~sagax_nb@user/sagax] has joined #java [01:21]
_ht [_ht!] has joined #java [01:37]
AlanMD [AlanMD!~AlanMD@] has joined #java [01:49]
TechTest [TechTest!] has joined #java [02:00]
luxemboy1 [luxemboy1!~luxemboye@gateway/tor-sasl/luxemboye] has joined #java [02:31]
Betal [Betal!~Betal@user/betal] has joined #java [02:36]
makara [makara!~sol@] has joined #java [02:47]
makara hi. I generated a "god class" report. The highest priority class is a "configuration" class with a bunch of protected properties and a lot of getters and setters. What am I doing wrong? [02:48]
fanis30 [fanis30!] has joined #java [02:49]
jetchisel [jetchisel!jetchisel@user/jetchisel] has joined #java [02:52]
jeukku [jeukku!~jeukku@user/jeukku] has joined #java [03:01]
fanis30 [fanis30!] has joined #java [03:04]
sa02irc [sa02irc!] has joined #java [03:16]
Matthijs [Matthijs!] has joined #java [03:23]
llorllale [llorllale!~llorllale@] has joined #java [03:27]
Markow [Markow!~Markow@] has joined #java [03:47]
qu4nt1n [qu4nt1n!~qu4nt1n@] has joined #java [03:51]
Maldivia makara: why do you think you did something wrong? [03:55]
Bebef [Bebef!] has joined #java [04:01]
hendursa1 [hendursa1!~weechat@user/hendursaga] has joined #java [04:03]
natten [natten!~natten-@] has joined #java [04:05]
hendursa2 [hendursa2!~weechat@user/hendursaga] has joined #java [04:06]
darksun [darksun!~darksun@user/darksun] has joined #java [04:06]
natten I have this springboot endpoint in a @RestController, does anyone know how i can have different tags @ApiOperation(tags = {...}) for each of the defined paths? Or would i need to duplicate the method to achieve that? [04:08]
Maldivia I would probably split it into individual methods [04:13]
makara Maldivia: because these classes are being reported as god-like [04:14]
Maldivia makara: and is that a problem? [04:15]
natten Maldivia: I have like 4 endpoints like this in the controller, so that will be very verbose. But if thats the only option for getting the doc right i think its worth it. [04:17]
makara Maldivia: [04:20]
Maldivia natten: [04:20]
Maldivia Maldivia's title: "Question/Bug: Path-Parameter should be specified as required when @RequestMapping has multiple paths. Issue #2634 springfox/springfox GitHub" [04:20]
Maldivia makara: I'm aware of what a god object is... but you're talking about something that holds your configuration... [04:21]
makara they're matched up with descriptor files [04:21]
makara i don't see they are classes and not "abstract interfaces" if that's the right term [04:22]
s0ullight [s0ullight!~s0ullight@] has joined #java [04:23]
makara googling "how to read a java descriptor" [04:23]
twofingersneat__ [twofingersneat__!] has joined #java [04:34]
jetchisel [jetchisel!jetchisel@user/jetchisel] has joined #java [04:56]
mexen [mexen!uid495612@user/mexen] has joined #java [05:10]
jetchisel [jetchisel!jetchisel@user/jetchisel] has joined #java [05:59]
imode [imode!~imode@user/imode] has joined #java [06:00]
computeiro [computeiro!~Wender@] has joined #java [06:24]
jeukku [jeukku!~jeukku@user/jeukku] has joined #java [06:39]
sbeex [sbeex!~sbeex@] has joined #java [07:05]
[itchyjunk] [[itchyjunk]!~itchyjunk@user/itchyjunk/x-7353470] has joined #java [07:41]
Covrus It looks like the M1 chip is supported by java 17 now, does anyone know where the M1 builds are or if sdkman has access to them yet? [07:42]
lucifer Covrus: macOS/aarch64 builds [07:43]
X-Scale` [X-Scale`!] has joined #java [07:45]
Covrus okay, so it's just sdkman that doesn't have access yet, thank you [07:48]
Maldivia Covrus: zulu and microsoft and bellsoft have been providing M1 builds for 8, 11, 15 and 16 as well [07:54]
Maldivia Covrus: and I see SDKMan has 17 from 4 different vendors on M1 [07:55]
Covrus the 17-open is still x86 [07:56]
Covrus file `which java` for 17.0.0-zulu shows x86_64 as well [07:57]
Covrus which java [07:57]
Covrus maybe I don't know how to check the platform of the executable properly [07:58]
Maldivia hmm, no I see, the 17-open is x64 [07:59]
Covrus the zulu looks that way too [08:00]
Covrus file on the libjava.dylib shows x86 as well, thought maybe it was just the launcher [08:00]
Maldivia yeah, it's SDK man bug [08:01]
X-Scale` [X-Scale`!~ARM@] has joined #java [08:01]
Maldivia Covrus: edit ~/.sdkman/etc/config [08:02]
Maldivia Covrus: set rosetta2_compatible to false [08:02]
Maldivia hmm [08:03]
Maldivia after that, log out and back into the console to get sdkman to refresh its config [08:03]
Maldivia then sdk rm java 17-open; sdk flush archives; sdk i java 17-open [08:04]
Covrus where did you find this, if I might ask? I did a search but didn't see anything about that flag [08:05]
Maldivia if you then run: java -XshowSettings -version 2>&1 | grep os.arch [08:05]
Maldivia you should see os.arch = aarch64 [08:05]
anovick_ [anovick_!~anovick@2a0d:6fc0:1831:1500:98e9:2c6f:1a52:52c0] has joined #java [08:05]
Maldivia Covrus: I looked in the source code [08:05]
Maldivia sdkman [08:05]
Maldivia SDKMAN is a tool for managing parallel installations of JVMs and tools on Mac/Linux/Unix. See - you can run it on Windows if you have a working Bash installation, too. To install java, you'd use "sdk install java" if you're wondering. [08:05]
Maldivia no, sdkman is <reply>SDKMAN is a tool for managing parallel installations of JVMs and tools on Mac/Linux/Unix. See - you can run it on Windows if you have a working Bash installation, too. To install java, you'd use "sdk install java" if you're wondering. To install macOS/aarch64 binaries, edit ~/.sdkman/etc/config and set the rosetta2 option to false! [08:06]
Maldivia OK, Maldivia. [08:06]
Covrus it works [08:07]
Covrus thank you and lucifer [08:07]
Maldivia Covrus: [08:10]
Maldivia Maldivia's title: "Release Add Rosetta 2 feature toggle for Silicon Mac sdkman/sdkman-cli GitHub" [08:10]
Maldivia Covrus: [08:14]
Maldivia Maldivia's title: "Feature: Re-evaluate sdkman_rosetta2_compatbile now that Java 17 is released Issue #975 sdkman/sdkman-cli GitHub" [08:14]
makara [makara!~sol@] has joined #java [08:20]
joev [joev!~joev@user/joev] has joined #java [08:23]
pikapika [pikapika!] has joined #java [08:27]
pikapika Is there a list of undefined behaviors of Java available somewhere? [08:28]
Maldivia there is no undefined behavior [08:28]
lucifer java does not have undefined behaviours like C/C++. [08:28]
pikapika For example, is it specified that an integer should be formatted as a signed 2s complement or is that only the case because I am on such a platform [08:28]
Maldivia pikapika: java is its own platform, ints are 2s complement [08:29]
jsmooth Damn. I cannot get Eclipse to recognize JavaFX even with e(fx)clipse [08:29]
pikapika Maldivia, like is that guaranteed to be true in any jvm in any platform? [08:29]
Maldivia pikapika: yes, if it's not true, it's not a jvm [08:29]
Maldivia jvms [08:29]
Maldivia Maldivia, jvms is short for the 'Java Virtual Machine Specification'; it is the official spec that defines what java (the virtual machine) is. You can find it at - you can also find the 'Java Language Specification' there, which defines java (the language). [08:29]
pikapika so if I do say n&0x08 >> 3 it is guaranteed to return the 4th bit? [08:30]
Maldivia always [08:30]
pikapika oh [08:30]
pikapika So the jvm specifies the format of the integers, how signed overflow, bit shifting overflow etc occur? [08:30]
Maldivia yep [08:30]
pikapika There is no udefined behaviour in a bit shift overflow? [08:30]
joev It's in section 2.3 of the JDK 17 spec (which you can get to from that link abobe) [08:31]
zeden [zeden!~zeden@user/zeden] has joined #java [08:31]
pikapika >If the promoted type of the left-hand operand is int, then only the five lowest-order bits of the right-hand operand are used as the shift distance. It is as if the right-hand operand were subjected to a bitwise logical AND operator & (15.22.1) with the mask value 0x1f (0b11111). The shift distance actually used is therefore always in the range 0 to 31, inclusive. [08:32]
pikapika Oh [08:32]
pikapika Interesting [08:32]
pikapika So overflow is avoided and it just uses a max val [08:33]
Maldivia no, as you see it uses a mask, so not max [08:33]
pikapika Yeah I meant the masking has that implicit effect [08:34]
Maldivia no it doesn't [08:34]
pikapika well if signed 2s complement is guaranteed then that mask limits the values to the 5 bits [08:34]
Maldivia correct, but that's not the same as using a max value [08:35]
pikapika oh right, not a max as in >=32 will remain 31 [08:35]
pikapika but [08:35]
pikapika rather that the value is always less than equal to 31 [08:35]
Maldivia it's an and 33 & 0x1f = 1 [08:35]
pikapika yes [08:35]
pikapika Either way its an acceptable way to avoids UB without destroying too much performance [08:36]
pikapika Nice trick [08:36]
internecine [internecine!] has joined #java [08:37]
Maldivia well, the alternative would be that for shifts >= 32 (for int), it would be the same as setting to 0 or -1, depending on sign bit and if sign extension was used [08:37]
Maldivia pikapika: note that >> uses sign extension, >>> doesn't [08:37]
jsmooth I guess really no one does JavaFX.. [08:37]
pikapika Maldivia, yes the main thing for me is that it is a specified behaviour [08:38]
Maldivia pikapika: welcome to Java -- where EVERYTHING is specified behavior [08:38]
Zapek jsmooth: I do [08:38]
jsmooth I'm trying to make it work with Eclipse [08:39]
jsmooth I installed e(fx)clipse, but Eclipse still doesn't recognize it [08:39]
pikapika It is a tradeoff [08:39]
Maldivia pikapika: ok, not exactly true, floating point semantics were not 100% defined, the JVM was allowed to utilize arch specific optmizations... that is until Java 17, where strictfp was enforced again [08:39]
pikapika But yes it is convenient [08:39]
pikapika I see [08:39]
pikapika Float would be hard to fully impose yeah without killing perf [08:40]
Zapek jsmooth: I use it with intellij and gradle [08:40]
Maldivia pikapika: yeah, bit with SSE/AVX instruction sets today, that is no longer the case [08:40]
wender [wender!~Wender@] has joined #java [08:40]
jsmooth Zapek: Did you buy IntelliJ? [08:41]
Zapek jsmooth: yes. but I don't see why it wouldn't work with the community edition [08:41]
jsmooth It's not supported by community edition [08:41]
Covrus you don't have to buy intellij to use javafx in idea, javafx is just a module, if your maven build includes it you're able to refer to it [08:41]
jsmooth Well, I tried, but couldn't get it to work [08:42]
jsmooth I'm willing to try again with some guidance [08:42]
Maldivia jsmooth: of course it is, EVERYTHING is supported in community edition, it's just a matter if there are extra plugins that has enhanced support [08:42]
Covrus you don't get the ultimate version's tooling for ee and fx and stuff but javafx doesn't need the ide tooling to work [08:42]
jsmooth What do you mean by IDE tooling? [08:43]
Covrus that's not how java works, your ide shouldn't be able to control what APIs u can use [08:43]
Maldivia jsmooth: javafx is just an api, like everything else, you can use notepad to write it in... now there might be some things in the paid version of IntelliJ that makes it easier to work with, but it's not needed [08:44]
jsmooth I don't care which IDE I am long as I can write and test my code [08:44]
jsmooth NetBeans, Eclipse, IDEA....either [08:45]
Maldivia that would be any IDE then [08:45]
jsmooth I would even settle for jEdit [08:45]
odinsbane ...even Dr. Java? [08:45]
jsmooth Dr Java is still around? [08:45]
jsmooth That's not an IDE is it? [08:45]
computeiro [computeiro!~Wender@] has joined #java [08:46]
Maldivia odinsbane: yes... Dr Java has a "Test Project" button :D [08:46]
odinsbane jsmooth: what is your javafx project so far? [08:46]
jsmooth What do you mean? [08:46]
jsmooth [08:46]
jsmooth jsmooth's title: "GitHub - longcurve/job-opening-tracker: An application to keep track of job applications" [08:46]
pikapika Maldivia, nothing wrong with notepad or nano etc [08:46]
pikapika I use it all the time [08:47]
Maldivia pikapika: they are editors though, not IDEs -- and yes, I was just editing using vim earlier today :D [08:47]
pikapika Its a bit harder for java because they prefer longer names but still fine [08:47]
odinsbane wow, spring and javafx and you haven't gotten javafx to work. [08:48]
Maldivia pikapika: longer names makes things more readable :D [08:48]
jsmooth Spring?? [08:48]
odinsbane Your pom.xml [08:49]
odinsbane It's loaded. [08:49]
jsmooth Hmm. [08:49]
wedr [wedr!] has joined #java [08:49]
joev vim+ctags+coc.nvim = close enough to an IDE for my needs. [08:49]
odinsbane It's pretty trivial to get a javafx + maven working properly in Intellij. [08:50]
pikapika IntelliJ is hard to run here [08:50]
pikapika I need to add more ram [08:50]
wender [wender!~Wender@] has joined #java [08:50]
joev what I really want is a good terminal/CLI debugger. JDB is painful- it doesn't even support arrow keys for command line editing [08:51]
yawkat [08:53]
mitch0 joev: rlwrap [08:54]
mitch0 joev: I mean, rlwrap jdb [08:54]
mitch0 also, nvim + java-language-server is probably better than the ctags approach [08:55]
Harlin [Harlin!~DonQixote@2603:300b:663:e800:ed29:6f25:3c3f:341e] has joined #java [08:55]
computeiro [computeiro!~Wender@] has joined #java [08:56]
vim_fans [vim_fans!~pi@user/vim-fans/x-3284168] has joined #java [09:00]
joev mitch0++ [09:00]
joev mitch0 has a karma level of 34, joev [09:00]
jsmooth What do I do about this? java: package org.hibernate is not visible [09:01]
jsmooth (package org.hibernate is declared in the unnamed module, but module com.splyndidxyz.job.opening.tracker does not read it) [09:01]
dmlloyd JPMS, sigh [09:02]
dmlloyd one solution is to use classpath mode [09:02]
dmlloyd (not modules) [09:02]
GreenResponse [GreenResponse!] has joined #java [09:03]
dmlloyd mixing the two is sure to lead to grief [09:04]
jsmooth IS that to me? [09:05]
Tenchi[m] `N: Unable to locate package zulu17` ? [09:05]
wender [wender!~Wender@] has joined #java [09:05]
dmlloyd yes jsmooth [09:11]
jetchisel [jetchisel!jetchisel@user/jetchisel] has joined #java [09:11]
lucifer javafx recommends modulepath. probably better to add hibernate as a module. [09:12]
dmlloyd only if hibernate is compatible with modules [09:12]
dmlloyd it's probably a lot easier getting javafx working on the classpath than getting the entire rest of the java ecosystem working on the module path [09:13]
hendursaga [hendursaga!~weechat@user/hendursaga] has joined #java [09:13]
user217_ [user217_!~andrii@] has joined #java [09:15]
computeiro [computeiro!~Wender@] has joined #java [09:15]
odinsbane You'll need a stub. [09:20]
dreamreal [dreamreal!~joeo@about/java/dreamreal] has joined #java [09:21]
odinsbane jsmooth: This has helloworld building examples of javafx. You can do it with modules or maven or whatever. get one of those to work in the flavor you like [09:22]
daoudr_ [daoudr_!~daoudr@] has joined #java [09:22]
odinsbane odinsbane's title: "GitHub - openjfx/samples: JavaFX samples to run with different options and build tools" [09:22]
daoudr_ Hi Guys. can someone help me understand what 'TE' stands for [09:23]
mitch0 test engineer? [09:24]
goepsilongo [goepsilongo!] has joined #java [09:24]
dmlloyd in your case, specifically a *male* test engineer: "...if he does not have the automation knowledge..." [09:25]
daoudr_ [daoudr_!~daoudr@] has joined #java [09:25]
daoudr_ so TE is test engineer? [09:27]
dmlloyd one can only assume [09:28]
Covrus I would think the author of that text is the one you should ask [09:28]
dmlloyd it might be "tomato entrepreneur" [09:28]
daoudr_ haha [09:29]
dmlloyd turkish emperor, etc. [09:29]
daoudr_ I might have turkish root. I should make dna test [09:29]
lucifer [09:31]
lucifer lucifer's title: "amber-docs/ at master openjdk/amber-docs GitHub" [09:31]
odinsbane It says scrum, so it is clearly talking about football. Tight End. [09:31]
daoudr_ -) [09:36]
Bebef [Bebef!] has joined #java [09:42]
mmfood [mmfood!~mmfood@] has joined #java [09:47]
Matthijs [Matthijs!] has joined #java [09:49]
mmfood [mmfood!~mmfood@] has joined #java [09:52]
Bebef [Bebef!] has joined #java [09:54]
magla [magla!] has joined #java [09:58]
mmfood [mmfood!~mmfood@] has joined #java [10:09]
anovick_ [anovick_!~anovick@2a0d:6fc0:1831:1500:98e9:2c6f:1a52:52c0] has joined #java [10:09]
sizeof_void34 [sizeof_void34!~Thunderbi@] has joined #java [10:11]
jetchisel [jetchisel!jetchisel@user/jetchisel] has joined #java [10:15]
karstensrage lucifer, i just read that, exciting, I love the way Brian Goetz lays out stuff [10:17]
lucifer indeed and it does look more powerful than plain string interpolation :D [10:17]
karstensrage im curious though, when he does the examples of the TemplatePolicys, they are embedded as defaults in things like String.format.. hes not really suggesting anything like TemplatePolicies.STR.format right? [10:22]
wender [wender!~Wender@] has joined #java [10:30]
computeiro [computeiro!~Wender@] has joined #java [10:36]
hnOsmium0001 [hnOsmium0001!] has joined #java [10:36]
jetchisel [jetchisel!jetchisel@user/jetchisel] has joined #java [10:38]
mmfood [mmfood!~mmfood@] has joined #java [10:46]
jetchisel [jetchisel!jetchisel@user/jetchisel] has joined #java [10:56]
makara [makara!~sol@] has joined #java [10:56]
jetchisel [jetchisel!jetchisel@user/jetchisel] has joined #java [11:00]
upgrdman [upgrdman!~upgrdman@] has joined #java [11:12]
csd [csd!] has joined #java [11:35]
csd Why would the following not be consistent across development environments? `new DecimalFormatSymbols(Locale.forLanguageTag("fr-fr")).getGroupingSeparator()` [11:39]
csd In some environments, it's a NBSP, and in some it's a regular space. [11:39]
jetchisel [jetchisel!jetchisel@user/jetchisel] has joined #java [11:41]
csd initially i thought it was a JDK-implementation specific detail but afaict that's not actually the case [11:44]
Maldivia csd: different JDK versions? [11:53]
csd Maldivia: i've confirmed that the behavior is independent of JDK version [11:53]
Maldivia ok, because they change it at some point [11:54]
Maldivia with java 9 they changed to use the unicode CLDR by default, or something like that [11:55]
csd using Oracle JDK 11.0.6 for Mac, my colleague gets one result and I get the other [11:55]
Maldivia which caused slight changes [11:55]
Maldivia csd: and shouldn't that be "fr-FR" ? [11:56]
Maldivia (no idea if it's case sensitive) [11:56]
csd from my testing it's not case sensitive [11:56]
csd if you output the locale's language/country it still says french/france [11:57]
Maldivia csd: check if the LocalProviderAdapter is the same [11:57]
dreamreal [dreamreal!~joeo@about/java/dreamreal] has joined #java [11:58]
Maldivia if its JRE OR CLDR or something else [11:58]
dreamreal - I find that approach to be ugly but workable, even in a Java context. It won't make most people who want simple string interpolation happy, though. C'est la vie. [11:58]
dreamreal dreamreal's title: "amber-docs/ at master openjdk/amber-docs GitHub" [11:58]
csd Maldivia: what would be the right way to check that? to print the value associated with the property `java.locale.providers` ? [12:00]
Maldivia javadoc LocaleServiceProvider [12:01]
Maldivia Maldivia: [JDK: java.util.spi.LocaleServiceProvider] [12:01]
Maldivia has more information [12:02]
csd ok, thanks i'll check that out [12:02]
Maldivia I don't remember if there is an api to check or checking the system property or reflection is the only way [12:03]
Maldivia but at least it could be a reason for the difference [12:04]
_ht [_ht!] has joined #java [12:04]
csd Maldivia: is there anything you can think of that, for developers working on the same project and with the same JDK version, have different locale providers be used _without_ manually specifying that property? (i.e., some dependency issue that might set it in one environment and not in another) [12:20]
stkrdknmibalz [stkrdknmibalz!] has joined #java [12:25]
csd [csd!] has joined #java [12:27]
tinyhippo I'm trying to run some tests via maven inside the maven:3-jdk-8 docker container, but I keep getting stuck on package does not exist - I've checked inside the lib of JAVA_HOME, and I can see tools.jar, which does contain the classes I'm referencing... why wont maven/javac find them? [12:36]
qu4nt1n [qu4nt1n!~qu4nt1n@] has joined #java [12:37]
Maldivia tinyhippo: what exactly is failing? maven or compiling some code that requires that package? [12:37]
tinyhippo Maldivia: failing to compile some code that requires that package [12:38]
Maldivia well, is tools.jar on the classpath? [12:38]
tinyhippo how would I determine what the classpath is [12:38]
tinyhippo (I am not a full-time java developer) [12:39]
Maldivia tinyhippo: well, is it defined as a dependency in the pom.xml file? [12:39]
tinyhippo I don't believe it is, no [12:39]
Maldivia well, then it's not on the classpath of course; tools.jar is not part of the normal runtime, you have to add it explicitly [12:40]
tinyhippo I see [12:40]
Maldivia for newer versions of java it's a module you can load [12:41]
Maldivia generally, com.sun* packages are considered internal and unsupported [12:41]
tang^ heh, I just ran into a com.sun:tools:1.8.0 issue yesterday with the Jenkins source [12:42]
tinyhippo I thought that tools.jar was a part of the runtime for jdk1.8? [12:42]
Maldivia nope [12:46]
Maldivia it's part of the JDK [12:46]
ernimril and the compiler api is available in the jre, but the tools.jar is not [12:47]
tinyhippo ok, so I need to add _something_ to my pom.xml [12:51]
Maldivia csd: are you sure that they are running with the same java version ? [12:52]
Maldivia csd: java 11, CLDR gives me U+00A0, java 16, CLDR gives me U+202F [12:53]
Maldivia (11.0.11 vs 16.0.1) [12:54]
yawkat whats the state of the adoptium api? there doesnt seem to be an adoptium api client artifact on central yet? [12:58]
Maldivia yawkat: there was one for adopt? [12:59]
yawkat yea [12:59]
yawkat yawkat's title: "Maven Repository: net.adoptopenjdk net.adoptopenjdk.v3.vanilla 0.4.0" [12:59]
yawkat i'm probably the only user, cant be bothered to go through github everytime for [12:59]
Maldivia yawkat: :D [01:00]
Maldivia Maldivia's title: "OpenAPI UI (Powered by Quarkus 1.13.7.Final)" [01:00]
yawkat shouldve picked micronaut! [01:01]
csd Maldivia: yes I'm sure [01:01]
yawkat but yea, the api is there, but no client on central... [01:01]
Maldivia yawkat: and the existing client, no way to change the api URL? [01:01]
yawkat well, turns out the old api has links to temurin too, so i guess it's no bother [01:01]
yawkat there is, but it's a bit ugly. [01:01]
yawkat wtf it has an osgi component. [01:02]
imode [imode!~imode@user/imode] has joined #java [01:04]
yawkat lombok still doesnt work on 17 does it [01:04]
wedr tang^, you are there, right? For com.sun:tools:1.8.0, you will need to use the jahia maven repository server to obtain the artifact. We actually use that artifact in our legacy projects. [01:05]
tang^ wedr: all I needed to do was make sure I was using a 1.8 JDK to run Maven [01:06]
tinyhippo I _am_ using a 1.8jdk to run maven, the tools.jar artifact is there, but not picked up by the application at compile time [01:06]
wedr hmm? I thought you can use it with JDK 11? [01:07]
Maldivia tinyhippo: you need it as a dependency as well [01:07]
Maldivia tinyhippo: meaning either as an external, or a system relativePath dependency [01:07]
tinyhippo like this? [01:08]
tinyhippo [01:08]
tang^ wedr: I couldn't... I got an error trying to run with JDK 11 [01:08]
Maldivia tinyhippo: might have to do ${java.home}/../lib/tools.jar [01:08]
tinyhippo yeah that was what I was missing [01:09]
wedr Huh... how did I do it on our Java 8 -> 11 upgrade... [01:09]
tinyhippo thanks Maldivia [01:09]
wedr oh well. [01:12]
jetchisel [jetchisel!jetchisel@user/jetchisel] has joined #java [01:42]
Markow [Markow!~Markow@] has joined #java [01:55]
wender [wender!~Wender@] has joined #java [02:35]
mmfood [mmfood!~mmfood@] has joined #java [02:39]
computeiro [computeiro!~Wender@] has joined #java [02:41]
Betal [Betal!~Betal@user/betal] has joined #java [02:55]
tachoknight [tachoknight!~tachoknig@2600:1700:3060:3ee0:3475:50b1:8fcd:e401] has joined #java [02:59]
sniperwolf [sniperwolf!~sniperwol@] has joined #java [03:07]
sniperwolf hello question about reflection. is there a way to get method of class by number of parameters? For example i have foo() and foo(String f, int f), can i get second foo by reflaction by specyfying something like getMethod("foo", argumentsSize(2)) [03:09]
sniperwolf or maybe just get list of methods from object that uses some name, and from that i could choose method with certain number of arguments? [03:10]
svm_invictvs Not that I'm aware of [03:11]
svm_invictvs You'd have to write something custom to search for that. [03:11]
ernimril call getMethods() and loop over it, not hard [03:12]
ernimril or possibly getDeclaredMethods() depending on exactly what you want [03:13]
sniperwolf ok but what if i have 2 methods with same number of parameters but different order... I dont think i can specify in such situations without giving perfect list of parameter classes on compile time, i want to avoid it [03:13]
sniperwolf i try to create mocking generator . Basically i specify method name, and return object and it should mock this method without specyfing parameters manually [03:25]
sniperwolf however i get error java.lang.IllegalArgumentException: object is not an instance of declaring class at when(invokeMethod) line. Not sure why that happens? [03:26]
ernimril sniperwolf, yes, if you have two methods with same number of arguments you need some more information at runtime to distinguish between them. How you do that can vary [03:27]
ernimril sniperwolf, care to explain why you want to use reflection and why you think this approach is the correct one? (reflection is most often the wrong way to solve things) [03:28]
sniperwolf i thnk i just cant do when(Object), is there way to cast it to reflection too? like when(object.castAs(clazz)) [03:28]
sniperwolf ernimril i just dont want to do when(instance.getSomething(any(),any(),any(),anyLong()).thenReturn(something), if i dont care abour parameters at all, just about return value [03:29]
ernimril sniperwolf, it is not clear what you are trying to do [03:29]
sniperwolf is it not clear from test i wrote? [03:30]
sniperwolf ernimril i want to do the same as this code is doing [03:31]
sniperwolf but dynamically, so i dont need to write any() inside method call inside when [03:32]
Maldivia and what you have doesn't work? [03:36]
sniperwolf yes, it does not work, it gives error above [03:37]
sniperwolf java.lang.IllegalArgumentException: object is not an instance of declaring class [03:37]
sniperwolf Object resultMocked = instanceMethod.invoke(getAnies.toArray(new Object[getAnies.size()])); this gives the same error [03:38]
Maldivia well, yeah -- Method is not a mock [03:39]
sniperwolf i guess i cannot invoke method with generic objects? i need to cast them to correct types first? [03:39]
Maldivia the signature is: Method.invoke(target, Object[] args) [03:39]
Maldivia but again, Method is not a mock, so you cannot do that [03:40]
sniperwolf ok, but it comes from a mock? [03:40]
Maldivia if anything, you would at leach need to do instanceMethod.invoke(mockObject, args) [03:40]
sniperwolf oh method comes from class that is not mock [03:41]
dreamreal [dreamreal!~dreamreal@about/java/dreamreal] has joined #java [03:42]
dreamreal - note benchmarks in jdk 11 vs jdk 17, jdk17's worst is better than jdk11's best. [03:42]
sniperwolf java8 Parameter - how do i get Class name out of it? [04:19]
Maldivia what you mean? getParameterTypes returns Class[] [04:20]
dmlloyd if you have a `java.lang.reflect.Parameter` you can call `getType()` on it [04:21]
dmlloyd that returns a `Class` [04:21]
dmlloyd but if the method doesn't have `Parameter`s on it, you're screwed [04:21]
Maldivia ahh, you're using getParameters()? don't :D [04:21]
dmlloyd you'll have to get the types off the `Method` as Maldivia says [04:21]
[twisti] thats pretty insane dre [04:23]
[twisti] thats pretty insane dreamreal* [04:23]
[twisti] oh he quit, thats why tab completion didnt work [04:24]
Maldivia dmlloyd: he's trying to "mock any method just by the name and use reflection to add correct any() to the number of args it has" [04:24]
sniperwolf Malidivia thank you thats what i did [04:24]
Maldivia [twisti]: yeah, dreamreal is in snipe mode at the moment; dumping in to past an interesting link and out again [04:25]
dmlloyd now I'm sure I don't want to know [04:25]
sniperwolf i think my program works - it finds method by: a: number of arguments, b: list of parameter class, but either a or b are optional if there is only one method with given name [04:25]
Maldivia sniperwolf: and then really think about what you're doing... tests are all about certainty... what you're currently doing seems to add a lot of uncertainty on top of the fact that you're already using mocks [04:27]
sniperwolf now i can mock return object of any 13 argument long method with no effort for given single testcase, it saves me lot of time [04:27]
sniperwolf Maldivia ok. But i test single testcase before i refactor it into many smaller methods. For example ihave large method with some piece of logic in the middle. I want to verify some mock gets called with right argument, while argument is result of logic in the middle [04:28]
sniperwolf so i am only interested in logic in the middle in given test case, so i dont see anything wrong with mocking rest of code to get desired state to exercise given piece of logic so ican later safely refactor it [04:29]
Maldivia good god I had the recent change in sdkman to add paging to version list... [04:30]
[twisti] is sniperwolf the guy who spent the last month on reinventing DI because he couldnt figure guice and didnt want to spend more than 30 minutes on reading up ? [04:30]
sniperwolf also imagine how less brittle tests are if you mock that way, you dont need to change mocks after every signature change [04:31]
sbalmos [twisti]: there have been so many... [04:31]
mbaxter [mbaxter!] has joined #java [04:32]
sniperwolf i would have to figure arquillian to get all stuff concerning transactions right [04:41]
sniperwolf guice would not even help with that [04:41]
sa02irc [sa02irc!] has joined #java [04:56]
mmfood [mmfood!~mmfood@] has joined #java [05:00]
junktext [junktext!~junktext@] has joined #java [05:00]
mmfood [mmfood!~mmfood@] has joined #java [05:07]
canton7 [canton7!~canton7@about/csharp/canton7] has joined #java [05:18]
shailangsa [shailangsa!] has joined #java [05:59]
dhch3 [dhch3!~dhch@] has joined #java [06:04]
Peste_Bubonica [Peste_Bubonica!~Peste_Bub@user/peste-bubonica/x-0568126] has joined #java [07:04]
[itchyjunk] [[itchyjunk]!~itchyjunk@user/itchyjunk/x-7353470] has joined #java [07:13]
Peste_Bubonica [Peste_Bubonica!~Peste_Bub@user/peste-bubonica/x-0568126] has joined #java [07:14]
vim_fans [vim_fans!~pi@user/vim-fans/x-3284168] has joined #java [07:23]
zacts [zacts!~zak@user/zacts] has joined #java [07:38]
zacts parted the channel: [07:38]
ferdna [ferdna!~ferdna@user/ferdna] has joined #java [07:48]
aac [aac!~AAC@2001:8a0:6cc5:7e01:cd59:a232:c85c:ecbf] has joined #java [07:56]
uidzero [uidzero!~uidzero@2601:603:1100:30e:a967:7fee:c0eb:efef] has joined #java [08:07]
jmartin [jmartin!~jmartin@user/jmartin] has joined #java [08:44]
db [db!] has joined #java [08:56]
vim_fans [vim_fans!~pi@user/vim-fans/x-3284168] has joined #java [08:58]
vim_fans_ [vim_fans_!~pi@user/vim-fans/x-3284168] has joined #java [09:19]
XerShadowTail_ [XerShadowTail_!stephanie@squirreljme/LeadSquirrel] has joined #java [10:00]
vdamewood [vdamewood!~vdamewood@fedora/vdamewood] has joined #java [10:29]
PocketKiller [PocketKiller!PacKetIV@user/packetiv] has joined #java [11:11]
hendursa1 [hendursa1!~weechat@user/hendursaga] has joined #java [11:22]
PocketKiller [PocketKiller!PacKetIV@user/packetiv] has joined #java [11:26]
jetchisel [jetchisel!jetchisel@user/jetchisel] has joined #java [11:36]
vim_fans_ [vim_fans_!~pi@user/vim-fans/x-3284168] has joined #java [11:47]