Info

Login

Channels

APIs

Credits

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

« 2020-04-05

2020-04-06

2020-04-07 »

Nick Message Date
iam730 [iam730!~iam730@c-71-198-201-85.hsd1.ca.comcast.net] has joined ##java [12:06]
Hal9k [Hal9k!~Hal9k@unaffiliated/kusanagi] has joined ##java [12:10]
padarc [padarc!~user@2a02:810d:8fc0:3ddc:d5a:28b1:ffdb:1fc1] has joined ##java [12:11]
kristijonas [kristijonas!~kristijon@78-56-32-39.static.zebra.lt] has joined ##java [12:22]
rajrajraj [rajrajraj!uid72176@gateway/web/irccloud.com/x-lmbjdxdtuzqscdls] has joined ##java [12:22]
hypc [hypc!~Thunderbi@175.164.17.134] has joined ##java [12:31]
sauvin [sauvin!sauvin@about/linux/staff/sauvin] has joined ##java [12:34]
fuxorn [fuxorn!~guardian@203.45.251.240] has joined ##java [12:44]
scpketer [scpketer!~scpketer@pppoe-46-226-70-145.prtcom.ru] has joined ##java [12:48]
tasse [tasse!~tasse@55d4470b.access.ecotel.net] has joined ##java [12:55]
adasr3 [adasr3!~Adium@cpe-75-82-35-30.socal.res.rr.com] has joined ##java [12:59]
dmiles [dmiles!~dmiles@c-73-67-179-188.hsd1.wa.comcast.net] has joined ##java [01:13]
led_dark_1 [led_dark_1!~Thunderbi@217.66.160.14] has joined ##java [01:15]
dendazen [dendazen!~dendazen@pool-72-76-93-243.nwrknj.fios.verizon.net] has joined ##java [01:21]
pzzx [pzzx!~pqzx@unaffiliated/pqzx] has joined ##java [01:38]
andinus [andinus!~andinus@49.36.14.254] has joined ##java [01:46]
devish [devish!345f4b18@unaffiliated/devish] has joined ##java [01:53]
kspalaiologos [kspalaiologos!~kspalaiol@176.221.122.71] has joined ##java [01:59]
palasso [palasso!~palasso@unaffiliated/palasso] has joined ##java [02:02]
devish [devish!345f4b08@unaffiliated/devish] has joined ##java [02:14]
SwiftMatt [SwiftMatt!~Objective@2601:282:4300:3e:ddc1:a782:8d70:20b9] has joined ##java [02:20]
upgrdman [upgrdman!~upgrdman@blender/artist/upgrdman] has joined ##java [02:33]
Mikaela_ [Mikaela_!Mikaela@gateway/vpn/mullvad/mikaela] has joined ##java [02:37]
SwiftMatt [SwiftMatt!~Objective@2601:282:4300:3e:ddc1:a782:8d70:20b9] has joined ##java [02:41]
germ13 [germ13!~germ13@cpe-104-172-241-157.socal.res.rr.com] has joined ##java [02:41]
Jantz [Jantz!~IceChat9@2407:7000:8d04:100:edbc:cad0:406c:5d48] has joined ##java [02:43]
exonity01 [exonity01!uid364582@gateway/web/irccloud.com/x-wdxiahbihjeoscgn] has joined ##java [02:50]
sb35 [sb35!~sb35@23.111.78.47] has joined ##java [02:52]
mitch0 [mitch0!~mitch@92-249-141-92.pool.digikabel.hu] has joined ##java [02:54]
bolovanos [bolovanos!~bolovanos@host-213-235-140-105.ip.topnet.cz] has joined ##java [02:56]
bolovanos [bolovanos!~bolovanos@host-213-235-140-105.ip.topnet.cz] has joined ##java [03:01]
Sasazuka [Sasazuka!~Sasazuka@unaffiliated/sasazuka] has joined ##java [03:10]
IoannisJVM [IoannisJVM!b03ac164@gateway/web/cgi-irc/kiwiirc.com/ip.176.58.193.100] has joined ##java [03:17]
con3 [con3!~con3@165.255.111.230] has joined ##java [03:18]
sa02irc [sa02irc!~mbax@155-079-043-212.ip-addr.inexio.net] has joined ##java [03:29]
adasr3 [adasr3!~Adium@2605:e000:1301:4a58:75d1:6656:38ee:3cd4] has joined ##java [03:31]
hooper [hooper!~hooper@75.164.3.93.rev.sfr.net] has joined ##java [03:38]
fragamus [fragamus!~textual@2603:3006:bb0:7000:f5fe:853e:aa1f:449] has joined ##java [03:43]
xeeder [xeeder!~quassel@ec2-18-218-240-192.us-east-2.compute.amazonaws.com] has joined ##java [03:46]
Rashad [Rashad!~chatzilla@86.108.102.225] has joined ##java [03:47]
immibis [immibis!~immibis@46.114.36.37] has joined ##java [03:49]
r0shi_ [r0shi_!~r0shi@bl17-119-69.dsl.telepac.pt] has joined ##java [03:50]
hinst [hinst!~hinst@ip5f5ad7ab.dynamic.kabel-deutschland.de] has joined ##java [03:51]
adasr3 [adasr3!~Adium@2605:e000:1301:4a58:f9aa:23c4:5ba2:a95c] has joined ##java [04:00]
donalsd [donalsd!9d285721@157.40.87.33] has joined ##java [04:18]
daseiboshi [daseiboshi!~daseibosh@ec2-34-192-134-30.compute-1.amazonaws.com] has joined ##java [04:18]
donalsd I have set my source and target in pom.xml of my maven project to 11, and while compiling I get this error: Fatal error compiling: invalid target release: 11 . I am running on javac 11.0.6. How do I fix this? [04:19]
Tuxist [Tuxist!~quassel@b9168f9f.cgn.dg-w.de] has joined ##java [04:19]
dendazen [dendazen!~dendazen@pool-72-76-93-243.nwrknj.fios.verizon.net] has joined ##java [04:21]
Maldivia if you get that error, you're not running with jdk11 [04:24]
Maldivia donalsd: you have <maven.compiler.release>11</maven.compiler.release> in your properties in your pom ? [04:24]
donalsd Maldivia: I have: <source>11</source><target>11</target> [04:25]
Maldivia well, first of, you should be using release if using jdk9+ to compile with [04:25]
Maldivia and then it looks like you're not actually using a JDK11 to compile with, if you're getting that error -- so verify what your JAVA_HOME is pointing to [04:27]
donalsd Yea I just upgraded to java 11 and forgot to update my JAVA_HOME. [04:27]
donalsd Maldivia: Could you elaborate on the maven.compiler.release properties vs source/target tags? [04:28]
Maldivia donalsd: https://openjdk.java.net/jeps/247 [04:28]
Maldivia Maldivia's title: "JEP 247: Compile for Older Platform Versions" [04:28]
Maldivia donalsd: basically --release 11 does the same as setting -source 11 -target 11, but on top of that, checks that you don't use API outside that version [04:29]
mihalyr [mihalyr!~mihalyr@gateway/tor-sasl/mihalyr] has joined ##java [04:31]
Maldivia sure, if you're creating something, that needs to run from java 7 and up, but you want to take advantage of newer APIs, making sure to guard it with the appropriate version checks, then source/target would be used -- but in most cases, you would want to use release now [04:33]
AcTiVaTe [AcTiVaTe!~activate@host-3at28h.tnz1.zeelandnet.nl] has joined ##java [04:33]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [04:33]
AcTiVaTe [AcTiVaTe!~activate@host-3at28h.tnz1.zeelandnet.nl] has joined ##java [04:34]
donalsd Maldivia, right. so I removed that source and target there but IntelliJ keeps complaining about a line needing to set language level 9+, and when I let intellij take care of it, it automatically sets the source target tags. [04:38]
Maldivia did you add the release line? [04:39]
donalsd Maldivia, yep. In properties. [04:39]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [04:39]
Maldivia dunno -- I've been using release for quite some time now in IntelliJ, working just fine [04:40]
Maldivia could also add the release in settings for the plugin, where you had source/target -- should be the same though [04:40]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [04:41]
donalsd Yea I think that fixed it. [04:42]
donalsd Ahh no doesn't seem like it. Although putting it in properties fixed it I think. Just refreshed. [04:43]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [04:54]
fada [fada!~fada@2-238-198-2.ip245.fastwebnet.it] has joined ##java [04:55]
bolovanos [bolovanos!~bolovanos@host-213-235-140-105.ip.topnet.cz] has joined ##java [04:57]
Cahaan [Cahaan!~Cahaan@91.182.14.22] has joined ##java [05:00]
Gazooo [Gazooo!~Gazooo@142.196.183.136] has joined ##java [05:07]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [05:10]
royal_screwup21 [royal_screwup21!~royal_scr@eduroam-wireless-pat7.nomadic.bris.ac.uk] has joined ##java [05:13]
Rashad Can someone please explain what exactly this is: https://docs.oracle.com/javaee/7/api/javax/xml/registry/infomodel/PostalAddress.html ? Is it like a standard class that I can reuse in my code? [05:18]
hypc [hypc!~Thunderbi@175.164.17.134] has joined ##java [05:18]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [05:19]
Rashad I am using Java 7 and I am trying in my IDE to find it, but although I can find `javax.xml` , I can't find `java.xml.registry` [05:19]
yawkat no, dont use it [05:19]
Rashad OK. [05:20]
Rashad Is there a standard class for a postal/physical address in Java? In general how do I search for such classes? [05:20]
yawkat there are few to no standard classes for complex data structures [05:22]
yawkat there are some for time or numbers or maybe finance but thats it [05:22]
Rashad I see. [05:22]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [05:23]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [05:25]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [05:32]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [05:32]
royal_screwup21 [royal_screwup21!~royal_scr@eduroam-wireless-pat7.nomadic.bris.ac.uk] has joined ##java [05:33]
cajetanp [cajetanp!~cajetan@5.151.46.31] has joined ##java [05:37]
cajetanp parted the channel: "WeeChat 2.8" [05:37]
scpketer [scpketer!~scpketer@pppoe-46-226-70-145.prtcom.ru] has joined ##java [05:39]
cfoch [cfoch!uid153227@gateway/web/irccloud.com/x-etzfwovbupxfskup] has joined ##java [05:40]
royal_screwup21 [royal_screwup21!~royal_scr@eduroam-wireless-pat7.nomadic.bris.ac.uk] has joined ##java [05:55]
somazero [somazero!~somazero@2600:8805:100:90:8eb5:ae00:a922:873f] has joined ##java [05:59]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [06:03]
radicate [radicate!~textual@bzq-109-64-64-42.red.bezeqint.net] has joined ##java [06:07]
markoong [markoong!~masrk@96.44.189.114] has joined ##java [06:09]
royal_screwup21 [royal_screwup21!~royal_scr@eduroam-wireless-pat7.nomadic.bris.ac.uk] has joined ##java [06:10]
kupi [kupi!uid212005@gateway/web/irccloud.com/x-efcievfodddpuajd] has joined ##java [06:12]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [06:14]
markong [markong!~masrk@46.23.78.24] has joined ##java [06:16]
dendazen [dendazen!~dendazen@pool-72-76-93-243.nwrknj.fios.verizon.net] has joined ##java [06:26]
dreamreal Rashad: did you look on google? (Note that addresses tend to be scoped to postal systems, so an encompassing one would be... interesting) [06:28]
mbooth dreamreal: A universal address object would contain a single String [06:31]
gelignite [gelignite!~gelignite@55d40a63.access.ecotel.net] has joined ##java [06:32]
dreamreal had formulated a quick, biting, SCATHING, incisive answer to that that was gonna BURRRRRRRRN but damn it I think that probably works [06:32]
dreamreal It's not easy to validate, though :) [06:34]
CombatVet [CombatVet!~c4@gateway/tor-sasl/combatvet] has joined ##java [06:36]
mbooth dreamreal: Yeah it is, just send a letter ;-) [06:41]
mbooth Same way you validate an email address ;-p [06:41]
Maldivia with a long regex? :D [06:41]
mbooth Ban Maldivia please [06:42]
surial Rashad: for reference, the address in various places in dubai is a scribbled map. [06:47]
surial Rashad: there is effectively nothing to be done internationally, except for a VERY small set of guarantees. Off the top of my head, [1] globally, addresses are case insensitive, [2] there is a global list of preferred spellings for countries, [3] an address consists of some number of lines, where the last line is a country. [06:48]
surial That's.. literally... _ALL_ you could possibly do there without writing up custom scripts per locale you wish to more thoroughly support. [06:48]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [06:48]
dreamreal decides to write a sternly written letter and send it to "surial, United Scrates" [06:49]
royal_screwup21 [royal_screwup21!~royal_scr@eduroam-wireless-pat7.nomadic.bris.ac.uk] has joined ##java [06:49]
surial my old roomie makes a hobby of sending mail to himself with bizarre addressing, and it usually arrives. Addresses such as 'Big Shiny Tower in the West of Kabbelgat, Netherlands', and that arrived ('Kabbelgat' is the 'carnival name' of Delft, and only one tiny section of delft tends to celebrate this, it is not particularly well known at all). [06:50]
mbooth "[2] there is a global list of preferred spellings for countries" is that really true? Where is this documented? [06:50]
mbooth I always thought the country was written as spelled locally (I always send letters to "France" but receive letters to "Royaume Uni") [06:50]
sonOfRa https://www.mjt.me.uk/posts/falsehoods-programmers-believe-about-addresses/ this is a helpful collection of AAAARGH about addresses. [06:51]
surial mbooth: I did say 'preferred spelling' :) ? it's the coding used when you order your stuff via one of those online forms and what they print, presumably. [06:51]
surial sonOfRa++ that's what I was thinking of. [06:51]
surial sonofra has a karma level of 195, surial [06:51]
surial mbooth: It's possible I'm misremembering this, but I'm pretty sure the 'last line on the address' rule is global. [06:52]
surial Also, if that wasn't... ???? how the fuck, right. [06:52]
mbooth surial: Well only the country from which you send needs to know destination country, why would you not spell it the local way? [06:53]
surial according to the dutch postal system, you can either address mail to say, belgium by ending the address with 'BELGI╦', 'BELGIUM', or 'BELGIQUE', or, instead of putting the postal code as, say, 1930 NOSSEGEM, put it a BE-1930 NOSSEGEM'. Presumably if the last line starts with a country code they route it? Can't find any rules when I google either. Christ, postal addresses is a minefield. [06:54]
surial mbooth: sometimes post gets routed via intermediates. [06:54]
xbyte1024 [xbyte1024!~xbyte1024@78-79-158.adsl.cyta.gr] has joined ##java [06:55]
Jantz [Jantz!~IceChat9@2407:7000:8d04:100:edbc:cad0:406c:5d48] has joined ##java [06:55]
db surial: a former colleague kept telling the story that he once received a letter addressed to <his name>, Switzerland. [07:03]
rajrajraj [rajrajraj!uid72176@gateway/web/irccloud.com/x-znsjbooilqvkhjkj] has joined ##java [07:03]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [07:04]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [07:16]
rippa [rippa!~rippa@ppp-vpdn-37.1.85.157.yarnet.ru] has joined ##java [07:22]
PyR3X [PyR3X!~PyR3X@cpe-67-249-205-179.twcny.res.rr.com] has joined ##java [07:23]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [07:30]
llorllale [llorllale!~llorllale@CPEac202e24ff83-CMac202e24ff80.cpe.net.fido.ca] has joined ##java [07:31]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [07:39]
sa02irc [sa02irc!~mbax@155-079-043-212.ip-addr.inexio.net] has joined ##java [07:46]
zwliew [zwliew!uid161395@gateway/web/irccloud.com/x-kvaovjqyzjgqeyzl] has joined ##java [07:58]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [07:58]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [08:01]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [08:05]
perrier-jouet [perrier-jouet!~perrier-j@modemcable012.251-130-66.mc.videotron.ca] has joined ##java [08:08]
Maldivia conventions [08:10]
Maldivia conventions is "ThisIsAClassName, thisIsAVariableOrMethodName, THIS_IS_A_CONSTANT_NAME, here.is.a.packagename". To camelcase an acronym, do DvdPlayer, not DVDPlayer. Also see https://google.github.io/styleguide/javaguide.html and https://github.com/google/google-java-format [08:10]
kupi google-java-format does not enforce naming conventions, it is for formatting whitespace [08:11]
Jantz [Jantz!~IceChat9@2407:7000:8d04:100:edbc:cad0:406c:5d48] has joined ##java [08:13]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [08:14]
cliluw [cliluw!~cliluw@unaffiliated/cliluw] has joined ##java [08:15]
dreamreal no format should enforce naming conventions [08:15]
dreamreal A linter should *report* violations [08:15]
radicate [radicate!~textual@bzq-109-64-64-42.red.bezeqint.net] has joined ##java [08:19]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [08:22]
immibis [immibis!~immibis@46.114.36.37] has joined ##java [08:22]
Maldivia dreamreal: google-java-format is a program that reformats source code to conform to the style guide [08:26]
dreamreal right...... [08:26]
Maldivia but yeah, naming conventions... me blind, envermind [08:27]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [08:29]
sdwrage [sdwrage!~textual@38.111.183.30] has joined ##java [08:31]
TimeTrap [TimeTrap!~TimeTrap@2601:44:c280:def:906b:ae68:9a5d:fbb6] has joined ##java [08:32]
dreamreal points back to the ban [08:32]
surial I should write a style guide: "Enforcement of style guides via autoformatting tools is fucking stupid, cut it out". [08:35]
surial that'll be in the preamble. [08:35]
Devastator maldivia_please :P [08:35]
dreamreal and the postlude, hopefully :) [08:35]
surial dreamreal: so, there's a problem there. [08:35]
surial On one hand, enforcing with no real way to opt out of it is overblown and reduces the programmer's ability to use their brain and skills to make code more readable and overrride the style guide. Which is sensible, because they are a fucking programmer, and if they are a moronbot, they have no business touching your sourcebase in the first place. however... [08:36]
surial we all make mistakes. a linter can and probably should, indeed, report violations, at least. [08:36]
mihalyr [mihalyr!~mihalyr@gateway/tor-sasl/mihalyr] has joined ##java [08:36]
surial So now the problem is, how do you deal with violations which are intentional? [08:36]
surial It seems silly to KEEP reporting them, every time you decide to do the 'okay, show me the violations' song and dance routine. No matter how that works (be it in-IDE wavy underlines, or a process you go through once a month), the mere fact that you have to ignore a big sack of 'violations' where you know it is better as it is and intentional violation of the guide is going to make you fuck up your code and adhere to the guide [08:37]
surial JUST to get rid of that endless warning. [08:37]
surial I guess.... associate with a git commit or whatever (because associating with a line number is tricky) that any style guide warnings in any line whose 'git blame' lists that git commit are verified as proper and should not be re-mentioned? [08:38]
surial My solution so far is to just not have linters for style at all, and aggressively refactor and rewrite whenever I see source code for any reason, which is slightly annoying (I was usually doing something else), but it's usually no big deal to fix a style fauxpas. Still, I bet I'm missing a couple of unfortunate style errors and I'd prefer to just keep a linter running near continuously. I don't, because of the sack of warnings I [08:40]
surial can't ignore. If anyone either knows of a linter tool thingie that has a sensible scheme for 'ignoring' a violation or a better idea than building up a list of git commit-associated stuff with a git blame style integration, I'd love to hear it. [08:40]
surial Maybe @SuppressWarnings("style") on something, except you can't annotate arbitrary AST nodes, and the presence of that alone would annoy the fuck out of me already so that's a non-starter, which then brings in the need to get fancy with how to track this in a separate file and in a way that changes to the code won't confuse the entry in the separate file. [08:41]
radicate [radicate!~textual@bzq-109-64-64-42.red.bezeqint.net] has joined ##java [08:44]
surial Nobody, huh? Shame. Feels like there's a better answer available than the current commonly chosen paths (which I'm pretty sure are the two extremes: Either have no linter at all, or have a styleguide-enforcing-linter whose verdicts cannot be appealed or ignored). [08:44]
dreamreal Or apply the linter every now and then when you are interested in making sure your code complies with some reasonable standard, which is sort of my approach [08:44]
surial I guess. But how do you deal with the list of stuff you already know is a violation, but intentional? [08:45]
surial just learn to read past em? [08:45]
dreamreal As opposed to having gatekeeper processes that are immalleable [08:45]
dreamreal surial: if *I* have intentional violations, they're going to be rare enough that I can put a comment in :) [08:45]
surial Hmm. Maybe I break with the guide a little more often than you do :P [08:45]
CookieM [CookieM!~tomek@bgm67.neoplus.adsl.tpnet.pl] has joined ##java [08:46]
mbooth surial: The eclipse formatter can read instructions from comments to turn the formatter on/off. So you can have auto-formatting turned on, whilst letting it ignore intentional style violations [08:46]
dreamreal The "you MUST satisfy the linter" people seem to have forgotten that programmers are involved and they have brains! BRAINS! BRAAAAIIIIINS! [08:46]
surial Also a lot of my style guide has hard rules that may not be broken, however a linter cannot check these. Such as 'tabs for indent, spaces for spacing'. The linter can't tell the difference, really. Perhaps I could add a rule that any given indent cannot add more than 1 indent level, but that only covers a tiny bit of it. [08:46]
wedr [wedr!~tom_mai78@pool-72-74-130-175.bstnma.fios.verizon.net] has joined ##java [08:46]
dreamreal although I will admit that when the zombie apocalypse actually does occur, most programmers will be safe as houses [08:46]
surial mbooth: I don't think that's going to work out, though. [08:47]
surial mbooth: in-file comments that modify style itself have an effect on style. [08:47]
surial I'm trying to make this shit readable. Having to festoon a bunch of magic comments into it is already starting at a disadvantage. I don't want that shit in the file then. Clearly this is a section where making it look grokkable is already difficult. [08:47]
mbooth Yeah I get that. Just pointing out a solution that works for me [08:48]
progart [progart!~kamee@46.162.231.90] has joined ##java [08:48]
Tungki [Tungki!728eac2a@subs20-114-142-172-42.three.co.id] has joined ##java [08:49]
surial You know, come to think of it, some more general system whereby you can 'annotate' (bad word, I don't mean '@' annotations at all) a source file, storing this info in a separate file or db like structure, where the point is that humans don't ever touch that file, it's always the tools, could be useful. You can store this stuff, but you can also store some coverage info, for example. I'd be cool if I can sit on a line in my [08:49]
surial editor, and hit a shortcut key to IMMEDIATELY jump to the test that covers this line / get a popup if 0 or more than 1 test hit it last time we ran tests. [08:49]
surial I guess for that one you can store it using the signature (pkg + type + methodname + paramtypes?), but being able to annotate any line or better yet any AST node would be even better. [08:50]
mbooth Eclemma stores this kind of info in order to show you the test coverage in-editor. [08:50]
surial nice. does it persist this? How does it 'key'? [08:51]
mbooth TBH I don't know [08:52]
twodee23 [twodee23!~johndoe@2409:4060:2190:a529:c53e:17a8:f3a9:dadf] has joined ##java [08:52]
Lengsdorfer [Lengsdorfer!~Lengsdorf@unaffiliated/lengsdorfer] has joined ##java [08:54]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [08:58]
Rashad surial: Thanks for the info [08:58]
Rashad I have a question. I am parsing a "message" (raw text or String) into a meaningful Message class. I am opting to use a MessageParser class, as the parsing process is elaborate and involved many methods and attributes. [09:06]
Rashad However, now I need to make the attributes of Message public so I can fill them up one by one inside MessageParser. [09:07]
Rashad I am also reluctant to make setters for these attributes as I don't really want any other class to modify them. [09:08]
dreamreal Sounds like you need a builder instead [09:08]
dreamreal or want one [09:08]
Rashad Builder sounds fitting -- is it like a static class? [09:08]
cheeser why public? why not have MessageParse work as a factory and have something like: public Message parse(<input>); ? [09:08]
cheeser not necessarily static, no. [09:08]
dreamreal Rashad: it sounds like a MessageParser class of some kind. You should try writing one of those! [09:08]
cheeser well, "static class" has a very strict definition. [09:09]
Rashad cheeser: I am kinda doing that, I think. In MessageParser I have a method: `public FWB16message parse(OutlookMessage rawMessage)` [09:09]
Rashad (FWB16message is Message and OutlookMessage is <input>) [09:09]
cheeser then OutlookMessage just needs a constructor. or at a minimum package private methods to fill it out. [09:09]
dreamreal right. Why doesn't that work? [09:10]
darkstardevx [darkstardevx!~darkstard@2601:1c2:300:c8a0::b4bf] has joined ##java [09:10]
gdrc [gdrc!~gdrc@unaffiliated/under] has joined ##java [09:10]
Rashad dreamreal: It returns Message, right? This means I need to do: return new Message();. If I use a constructor, I will have to define many variables that hold the values until I feed them all at the same time to the constructor. [09:11]
Rashad And defining all these variables is kinda like a mirror of the attributes for the Message class. [09:11]
Rashad So instead I am thinking I should set the values one by one to my new Message(); [09:12]
dreamreal Rashad: ... [09:12]
surial pastebin [09:13]
surial Please paste your code and any errors online. For runnable classes, try https://ideone.com/ . For general code and errors, use https://gist.github.com or https://dpaste.org/ [09:13]
progart [progart!~kamee@46.162.231.90] has joined ##java [09:13]
surial Rashad: https://dpaste.org/63JH [09:13]
surial that's what builders are. [09:13]
Rashad OK hold on. [09:13]
Devastator surial jesus christ, did you write this pastebin in.. 20 seconds?! [09:15]
surial Devastator: nah mate, took me a minute or two. [09:15]
dreamreal Rashad: to some degree, what you're saying here is equivalent to "I need this code I've written." [09:15]
Rashad Not exactly. [09:15]
Devastator even then.. you type really fast heheh [09:15]
Rashad I am asking because I am not sure I should continue with it. [09:15]
Rashad surial: I am trying to understand that builder class... in fact before you posted that I wanted to ask if I should make MessageParser an inner class of Message... is this the same thing? [09:17]
surial not entirely, but there are similarities. [09:17]
surial by making it an inner type you can make the setters, fields, constructors, yadayada package private or fully private and you can still call them from the inner. [09:17]
surial however, there are advantages if your Message class is _FULLY_ immutable, and not just 'appears immutable to outsiders'. [09:17]
Rashad Aha. [09:18]
Rashad And that's done by using "final" in `public final class Person` ? [09:18]
surial that is mostly irrelevant. [09:18]
surial that just means nobody can subclass Person. A good idea probably but not too important. [09:18]
surial No, it's the 'final' on each field. [09:18]
Rashad I see I see. [09:19]
surial that does two things: [A] this thing really is fully immutable. A message is what it is as it is when created and cannot change, and [B] it means the constructor must set everything, or it won't compile. That last one is quite a drag, _unless_ you have a 'mirror' class that looks just like it, but with non-final fields, which you use as 'scratch space'. As in that paste. But it's a lot to type, so, use lombok, gets rid of the [09:19]
surial boilerplate, now you have a fancy nice API withOUT the burden of having to type it all out. [09:19]
dreamreal how dare you promote lombok without pointing out that you're one of its primary authors!! </humor> [09:21]
Rashad Hmm. [09:22]
Rashad He is? [09:22]
dreamreal he is, yes [09:23]
dreamreal loombok's fantastic for java [09:23]
dreamreal lombok, rather - his suggestion to use it is ENTIRELY warranted [09:23]
Rashad This is supposed to be a very tiny and temporary program... I am not sure I should use a library for this. [09:23]
dreamreal I can almost guarantee that anything lombok generates is going to be of better quality than anything you'll write [09:23]
dreamreal Rashad: lombok is not a runtime dependency [09:24]
Rashad Oh so it just generates code? [09:24]
dreamreal yes [09:24]
Rashad Does it work with Java 7? [09:24]
Rashad ducks [09:24]
dreamreal yes [09:24]
Rashad Oh nice. [09:25]
dreamreal is NOT a lombok author so has no ethical problems promoting it like maaaaad [09:25]
CombatVet [CombatVet!~c4@gateway/tor-sasl/combatvet] has joined ##java [09:26]
Devastator can I promote it as well? use lombok, people! [09:26]
dreamreal no, you're a doof [09:26]
dreamreal you're not allowed to talk [09:26]
surial Oh, I thought I mentioned before that I obviously always have lombok set up for all projects, but I aborted that particular message, my apologies for shilling my own project without a disclaimer, it wasn't intentional :) [09:26]
dreamreal bwahahaha [09:27]
Devastator dreamreal sorry :( [09:27]
surial Rashad: lombok does work with java7 (hell, it works on 6!), but we're one of the last compiler plugin style tools. eclipse has left java7 and below behind a long time ago already for example, and they tend to stick around with support for the olds for quite a while. You really should upgrade :P ? and the day may soon come we drop support for 6 and 7. [09:28]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [09:29]
surial (hell, as part of the lombok build, we compile with -release 1.5, for good reasons). [09:29]
surial (not all of lombok, smallish parts of it). [09:29]
mbooth surial: Eclipse left Java 7 and below as a runtime req, but ecj still accepts "-source 1.3 -target 1.1" :-o [09:29]
mbooth (This actually caused me grief last week) [09:30]
radicate [radicate!~textual@bzq-109-64-64-42.red.bezeqint.net] has joined ##java [09:30]
surial that it supports -source 1.3, or that eclipse no longer runs on JDK7-? [09:30]
mihalyr [mihalyr!~mihalyr@gateway/tor-sasl/mihalyr] has joined ##java [09:30]
dendazen [dendazen!~dendazen@pool-72-76-93-243.nwrknj.fios.verizon.net] has joined ##java [09:31]
mbooth I foolishly tried to compile a part of Eclipse on with javac 11 that is required to work on Java 1.1 and up (it silently failed due to comedy mis-use of ant) [09:32]
mbooth Long story short: IBM still care about such ancient tech, apparently [09:33]
cheeser backwards compatibility is sacred. :D [09:35]
progart [progart!~kamee@46.162.231.90] has joined ##java [09:36]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [09:37]
sim590 [sim590!~sim590@modemcable007.202-59-74.mc.videotron.ca] has joined ##java [09:38]
darkstardevx [darkstardevx!~darkstard@2601:1c2:300:c8a0::b4bf] has joined ##java [09:38]
zeden [zeden!~user@unaffiliated/zeden] has joined ##java [09:39]
Rashad I am not really sure how lombok works, and since I am supposed to finish today or tomorrow, I don't have much time to learn it. [09:40]
sim590 I have this signature `static public <T> void quicksort(Collection<Comparable<T>> col)` and I'd like to call compareTo with the objects of the collection, so for instance if I have one of the elements called Comparable<T> x and I try to compare to another Comparable<T> y like x.compareTo(y), it fails since compareTo expects a T, not a Comparable<T>, but I don't know how to ge the underlying value? [09:40]
Rashad Sorry surial [09:40]
sim590 For more context, here is a snippet of what I have in my buffer currently: https://paste.debian.net/1138698/ [09:42]
dreamreal sim590: um... does T extend Comparable<T>? [09:42]
sim590 dreamreal: I guess that's what I'm trying to do here. [09:43]
dreamreal sim590: in the standard library, there's an option for sort that takes a comparator so the T doesn't have to implement compareTo() itself [09:43]
dreamreal (and Collections.sort is, if memory serves, a quicksort) [09:43]
dreamreal although... is quicksort stable? [09:44]
themsay [themsay!~themsay@2.126.79.90] has joined ##java [09:44]
sonOfRa Last I checked it was timsort, which is a hybdird merge and insertion sort [09:44]
dreamreal sonOfRa: *nod* okay, wasn't sure [09:44]
dreamreal (this is why I said "if memory serves" - my detail memory is not especially fantastic, and I wasn't taking the time to check) [09:46]
sim590 I guess that I'm not writing the restriction on T correctly. I want to ensure that T is implementing Comparable. So I have to put a restriction on the generic type I'm writing. [09:46]
sim590 So I guess that I would like T type, but with a restriction on it. [09:46]
dreamreal well, look at the declaration for Collections.sort() [09:47]
dreamreal There's one that expects T to implement Comparable<T> and one that doesn't [09:47]
pinusc [pinusc!~weechat@227.ip-54-37-204.eu] has joined ##java [09:47]
dreamreal (if you're lazy: public static <T extends Comparable<? super T>> void sort?(List<T> list)) [09:47]
sim590 Isn't this correct ? static public <T extends Comparable> void quicksort(Collection<T> col) [09:48]
dreamreal does it work? [09:48]
sim590 Yeah, but now T.compareTo expects an Object. I'm not sure if that's OK. I'm returning to java after a few years. [09:49]
dreamreal sim590: ... well, see, that's a "doesn't work" - the T extends Comparable<? super T> changes the signature of compareTo [09:49]
sim590 Oh. I changed it to <T extends Comparable<T>>. [09:50]
sim590 And it's fine now. [09:50]
dreamreal Not quite the same thing but if it works for you, that's good [09:50]
plarsen [plarsen!~plarsen@redhat/jboss/pdpc.professional.plarsen] has joined ##java [09:50]
cheeser it's the correct answer insofar as it meets his needs as spec'd in the method def above [09:51]
dreamreal yep [09:51]
pikapika [pikapika!~pikapika@pika.powered.by.lunarbnc.net] has joined ##java [09:55]
Rashad I ended up doing this: https://dpaste.org/tzLS (make sure not to miss the comment at the end because of the faded font color) [09:57]
Rashad (and don't judge me) [09:57]
progart [progart!~kamee@46.162.231.90] has joined ##java [09:57]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [09:58]
cheeser personally, i'd make parse() static on FWB16message and hide the parser class away completely [09:58]
Rashad How do you mean hide it? [09:59]
Rashad Ah OK [09:59]
Rashad I get it now. [09:59]
Rashad Makes sense. [10:00]
darkstardevx [darkstardevx!~darkstard@2601:1c2:300:c8a0::b4bf] has joined ##java [10:03]
Maldivia so you made a factory method :D [10:03]
Rashad Yes I think. [10:04]
cheeser you did. ;) [10:05]