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

« 2021-01-14


2021-01-16 »

Nick Message Date
AAC i think this is a bug, can anyone check it ? using java 8, that's why i ask [12:02]
AAC AAC's title: "string_zero" [12:02]
db a charset defines how a character is encoded binary data. and if there is no character represented by the byte value 0, it is not supported by the charset. A charset will sometimes use multiple bytes to encode a character, and some of those bytes may be 0. [12:03]
db that is a char array and not a byte array [12:03]
AAC but why does it support like 1 and 2 and not zeroo? [12:03]
AAC yep..char = 0 also doesnt work [12:04]
AAC same as byte [12:04]
db what do you mean "doesn't work", what do you expect to happen? [12:05]
AAC print zero and 12 [12:06]
AAC i think that a strange thing is, the string print until a zero..which is kind of awkard [12:06]
AAC reminds me of c :) [12:06]
db there is a misunderstanding there. you are writing numbers into a char array. if you want to print zero and 12 you need to use the char values '0' '1' and '2', not the number 0 1 and 2 [12:06]
AAC no no..i meant really printing 0 [12:07]
AAC not character 0 [12:07]
AAC i used byte on my computer, but pasted as char [12:07]
db what does "really printing 0" look like? [12:07]
AAC like , printing 1 , print a small box (unicode) [12:07]
AAC anyway, the reasoning was the following , (that's why i used char) . To print the string (even with chars, and not bytes), it stops at char = 0 [12:09]
AAC being a string a char array [12:09]
AAC i can accept that zero is not on the enconding..i dont understand is why the printing stops at 0 [12:10]
AAC hold on let me take a look at source :) [12:10]
db [12:10]
db db's title: "U+0000 <Null> (NUL) Unicode Character" [12:10]
AAC yep..its a NULL! [12:11]
AAC i was just curious, the relationship between c , java , and null :)) [12:12]
orbyt_ [orbyt_!~orbyt@] has joined ##java [12:19]
dqx [dqx!~dqx@unaffiliated/dqx] has joined ##java [12:35]
ADG1089__ [ADG1089__!~aditya@] has joined ##java [12:35]
dqx [dqx!~dqx@unaffiliated/dqx] has joined ##java [12:52]
varaindemian_ [varaindemian_!~varaindem@] has joined ##java [12:57]
dqx [dqx!~dqx@unaffiliated/dqx] has joined ##java [12:58]
varaindemian_ [12:59]
varaindemian_ is line 18 really needed? [12:59]
varaindemian_ code still works after removing that and the variable from the signature of the function [01:00]
dqx [dqx!~dqx@unaffiliated/dqx] has joined ##java [01:22]
runlevel7 [runlevel7!runlevel7@gateway/vpn/privateinternetaccess/runlevel7] has joined ##java [01:24]
ScrambledRK [ScrambledRK!] has joined ##java [01:36]
Scropion123 [Scropion123!~Leonlit@] has joined ##java [02:05]
BluesBoy [BluesBoy!] has joined ##java [02:26]
mvm [mvm!] has joined ##java [02:32]
Lengsdorfer [Lengsdorfer!~Lengsdorf@unaffiliated/lengsdorfer] has joined ##java [02:36]
r3m1 [r3m1!~r3m1@2a01:e34:ee77:8c00:2145:2848:d4df:7556] has joined ##java [02:43]
mizux [mizux!] has joined ##java [02:51]
mindCrime [mindCrime!] has joined ##java [02:53]
bolovanos__ [bolovanos__!~bolovanos@unaffiliated/bolovanos] has joined ##java [02:56]
dendazen [dendazen!] has joined ##java [03:00]
runlevel7 [runlevel7!runlevel7@gateway/vpn/privateinternetaccess/runlevel7] has joined ##java [03:00]
Cahaan [Cahaan!] has joined ##java [03:03]
Matthijs [Matthijs!~quassel@unaffiliated/matthijs] has joined ##java [03:14]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [03:16]
_lucifer varaindemian_: what did you remove? [03:25]
varaindemian_ _lucifer, line 18 [03:25]
_lucifer varaindemian_: then where do you store the result? [03:25]
varaindemian_ _lucifer, now I see that I pasted the wrong code.. [03:27]
varaindemian_ nevermind [03:27]
varaindemian_ _lucifer, thank you [03:27]
_lucifer also, you probably do not need the String.valueOf [03:28]
LKoen [LKoen!] has joined ##java [03:32]
orbyt_ [orbyt_!~orbyt@] has joined ##java [03:38]
oakridge [oakridge!] has joined ##java [03:38]
varaindemian_ _lucifer, yeah [03:56]
varaindemian_ I used BigInteger.valueOf instead [03:58]
bosaap [bosaap!] has joined ##java [04:10]
sa02irc [sa02irc!] has joined ##java [04:23]
ib07 [ib07!] has joined ##java [04:30]
troydm [troydm!~troydm@unaffiliated/troydm] has joined ##java [04:45]
FabioP [FabioP!] has joined ##java [04:47]
Hanii [Hanii!~Hanii@2a00:23c5:c587:6d00:ecba:2847:ff99:e7f2] has joined ##java [04:53]
SirMangler [SirMangler!] has joined ##java [05:04]
Hanii I've started using Assert4J for testing. I'm wanting to use .containsExactlyElementsOf with a custom equals - .usingElementComparator seems to allow that by passing in a comparator, but how do I implement that for elements that don't have any kind of obvious order? Do I override the equals and ignore the compareTo, do I ignore the equals and override the compareTo to return 0 when equals and 1 when not equals, if one object returns [05:06]
Hanii 1 when compared to a second, does the second have to return -1 for comparing that against the same object, for use with this? etc. [05:06]
Hanii I've tried googling it, but I can only find information on how to use it once you have a comparator you want to use with this function [05:06]
LKoen [LKoen!] has joined ##java [05:21]
chewb [chewb!] has joined ##java [05:24]
sphinxo [sphinxo!5118c732@] has joined ##java [05:25]
chewb Whats the point of refactoring, if its supposed to make testing easier, but you cant begin to refactor method if you dont have test suite to it? [05:25]
mbooth Huh? That's not the only reason you would refactor [05:30]
mbooth chewb: But in your case, write the test first, that way you confirm refactoring doesn't change the behaviour [05:30]
chewb its hard to write good tests for long method that calls many private methods and does tons of stuff [05:31]
Maldivia chewb: well, start by making tests for your APIs [05:32]
chewb whats the api? [05:32]
Maldivia do you have anything that interacts with your program in any way ? [05:33]
archer121 [archer121!3d027858@] has joined ##java [05:33]
Maldivia or how do your components talk to eachother ? [05:33]
mbooth chewb: The API is your classes' public methods [05:34]
chewb yes, long methods that calls tons things and calls lot of private methods [05:35]
mbooth So? [05:36]
chewb like renewal something is "delete old, update current and create new, but do some of these things to only in certain conditions". So you need to write ton of tests to satisfy all conditions, then you can begin refactor [05:37]
mbooth Well, get on with it then :-) [05:37]
chewb when you push some private method into different class you may need to mock it, and create new test for class where you moved this method [05:37]
Maldivia why would you need to mock anything? [05:38]
mbooth The test suite I most interact with has 145,636 tests. [05:38]
mbooth "Tons of tests" is not a bad thing [05:38]
Maldivia yeah, we don't have that many individual tests, we mostly have integration tests, but they then run in like a thousand different environments [05:39]
AcTiVaTe [AcTiVaTe!] has joined ##java [05:40]
Maldivia Ohh, here's a JPA test... now go test it on Hibernate, TopLink, EclipseLink, OpenJPA... and a few different versions of each... and then run it on WildFly, Tomcat, Jetty, WebSphere, JBossEAP, etc.... and on several different versions of each [05:41]
mbooth combinatorially explodes [05:41]
conan [conan!] has joined ##java [05:42]
mbooth We just do 3 platforms 2 JDKs [05:42]
mbooth Shockingly we don't test on aarch64, despite now shipping a aarch64 IDE [05:43]
Maldivia mbooth: we also have just class reloading tests... they run on 20 diffent JDKs, and in classpath and modulepath mode, and also with and without native support :D [05:43]
Maldivia mbooth: I've been waiting for a mac M1 for a while now, so I can finally test my aarch64 binaries! [05:44]
mbooth \/ [05:44]
mbooth Please download Eclipse and tell me if it works, I will fix it if it doesn't :-) [05:44]
chewb Maldivia can you help me with testing CDI injection? Class has field Instance<InterfaceObj>, and i can use this field to loop over all implementations of this interface. I dont know how to create unit test for that. I tried with arquillian, needlerule, weld-se, there was always something wrong [05:45]
mbooth Oh wait, damn, we only ship aarch64 for linux, not yet macos [05:45]
Maldivia mbooth: then fire up an aaarch64 linux on AWS? [05:46]
mbooth Maldivia: I have a aarch64 machine already, but I don't go near macos :-) [05:47]
bosaap [bosaap!] has joined ##java [05:47]
mbooth I thought we had macos binaries too, but looks like not yet [05:47]
Maldivia chewb: ehh, you need a CDI container for testing that [05:47]
Maldivia chewb: for instance weld-junit [05:48]
tilerendering [tilerendering!~tilerende@c-base/crew/conx] has joined ##java [05:48]
chewb i tried using weld-se already i still got error like "No implementation of CDI found" [05:48]
chewb can you show me example test? [05:48]
Maldivia @EnableWeld public class MyTest { @Inject Foo foo; @Test void myTest() {; } } [05:49]
black_ant [black_ant!~antilope@unaffiliated/black-ant/x-1505394] has joined ##java [05:49]
Maldivia [05:50]
chewb i added this maven dependency, but still cant import enableweld [06:03]
LionBar [LionBar!~l@gateway/tor-sasl/lionbar] has joined ##java [06:03]
ChaiTRex [ChaiTRex!~ChaiTRex@gateway/tor-sasl/chaitrex] has joined ##java [06:03]
fingo [fingo!~fingo@gateway/tor-sasl/fingo] has joined ##java [06:03]
asymptotically [asymptotically!~asymptoti@gateway/tor-sasl/asymptotically] has joined ##java [06:03]
CombatVet [CombatVet!~c4@gateway/tor-sasl/combatvet] has joined ##java [06:03]
luxemboye [luxemboye!~luxemboye@gateway/tor-sasl/luxemboye] has joined ##java [06:03]
CombatVet [CombatVet!~c4@gateway/tor-sasl/combatvet] has joined ##java [06:04]
mbooth chewb: Clearly not the right dep then [06:05]
mbooth What did you actually add? [06:05]
NorthwestVegan [NorthwestVegan!~Northwest@gateway/tor-sasl/northwestvegan] has joined ##java [06:07]
chewb weld-junit-parent [06:09]
chewb i will try with weld-junit5 now [06:09]
Maldivia are you using junit ? and if so 4 or 5? [06:09]
chewb some are still using 4, but mostly 5 [06:09]
mbooth chewb: weld-junit-parent is just, perhaps obviously, a parent pom [06:10]
Maldivia yeah, that would be a pom dependency; so the article listed is a bit wrong :D [06:10]
Suchorski [Suchorski!~regex@unaffiliated/suchorski] has joined ##java [06:11]
mbooth Yeah the article is wrong, but chewb's internal monologue should have said "wait, there is no jar associated with these maven coords" :-) [06:11]
chewb i get error : test Terminated [06:13]
chewb test class [06:13]
chewb class under test [06:15]
retroguy8000 [retroguy8000!~retroguy8@] has joined ##java [06:17]
dreamreal morning [06:18]
chewb classpath [06:18]
Jonopoly [Jonopoly!~Jonopoly@unaffiliated/jonopoly] has joined ##java [06:21]
Maldivia chewb: well, you might need to add the @WeldSetup part as well [06:22]
Maldivia chewb: like @WeldSetup public WeldInitiator weld = WeldInitiator.of(WeldInitiator.createWeld().beanClasses(ReportService.class, SalesReportGenerator.class, etc, etc)); [06:23]
Maldivia if they live outside the package [06:23]
chewb is WeldInitiator.from(ReportService.class).build() shortcut for what yoy wrote? [06:24]
Maldivia yes [06:24]
markong [markong!~markong@] has joined ##java [06:25]
tomboy64 [tomboy64!~tomboy64@gateway/tor-sasl/tomboy64] has joined ##java [06:25]
chewb they live in same package - class and interface. Still same error [06:26]
chewb still the same, tests are not being called at all , failed on start "Terminated" error [06:31]
Maldivia chewb: -- simple example -- FooTest is in src/main/test, the two beans are in src/main/java [06:31]
chewb thank you [06:32]
Maldivia chewb: as you can see, it finds the two beans, but I have also added them explicitly to Weld :D [06:32]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [06:33]
chewb so you by you actually call [06:34]
Maldivia I call both [06:34]
Maldivia in the output you can see "class com.test.weld.SubFooBean - com.test.weld.SubFooBean@319dead1" and "class com.test.weld.FooBean - com.test.weld.FooBean@a7e2d9d" which is the output from foo -- yeah, could have made it more visible :D [06:35]
mbooth Gah, someone added a usage of Optional to this project :-( [06:37]
chewb Malidiva i copy pasted your classes to my project, still same error "Terminated" on test startup. Whats your pom.xml? [06:38]
[twisti] mbooth: must have sonarlint rules forbidding that! [06:44]
[twisti] (at my job, we are currently discussing grabbing various metrics such as usage counts of frowned upon things like that, and to get a MR approved that raises any of the metrics, you need someone to sponsor it [06:45]
chewb seems like that same problem but i have supported junit version <version.junit.jupiter>5.7.0</version.junit.jupiter> [06:47]
chewb chewb's title: "Latest weld-junit5 2.0.x doesn't work with junit api 5.6.0 Issue #2179 junit-team/junit5 GitHub" [06:47]
chewb i added junit-platform-launcher dep still does not work [06:52]
archer121 hi [06:56]
chewb i added junit engine, still get error, but at least it get called uff [06:56]
chewb here is error same with your test Maldivia [06:57]
dreamreal chewb: ... [07:03]
dreamreal bites tongue [07:03]
conan [conan!] has joined ##java [07:12]
chewb probably priority of implementations to fetch [07:18]
Maldivia chewb: -- those are the two relevant entries in my pom.xml [07:18]
Maldivia (no direct dependency on junit, since weld-junit5 pulls it in anyway) [07:19]
kspalaiologos [kspalaiologos!~palaiolog@] has joined ##java [07:32]
_lucifer [07:32]
_lucifer (spoiler the longest name is mostly the correct answer) [07:32]
ADG1089__ [ADG1089__!~aditya@] has joined ##java [07:33]
conan [conan!] has joined ##java [07:33]
RiskyExpert [RiskyExpert!~RiskyExpe@] has joined ##java [07:33]
chewb still get errors even after adding your jakarta dep Maldivia [07:43]
chewb java.lang.NoClassDefFoundError: jakarta/enterprise/inject/spi/BeanManager [07:44]
dreamreal so fix it [07:45]
dreamreal it's classpath, fix it [07:45]
chewb why does it even uses jakarta anyway, weld is using jakarta? my app is on java ee not jakarta [07:50]
dreamreal if only these concepts were not really basic for java [07:50]
Maldivia chewb: because you're using a too new version of Weld then [07:51]
Maldivia are you using Weld4? [07:51]
di0_ [di0_!~di0_@unaffiliated/di0-/x-5053590] has joined ##java [07:53]
ADG1089__ [ADG1089__!~aditya@] has joined ##java [07:58]
chewb i used weld 2 something before and got other kind of error - [08:02]
chewb i changed to weld4 now, yes [08:02]
ADG1089__ [ADG1089__!~aditya@] has joined ##java [08:03]
Maldivia well, weld4 is Jakarta EE 9 [08:06]
ADG1089__ [ADG1089__!~aditya@] has joined ##java [08:07]
Maldivia Weld3 is Java EE 8 / Jakarta EE 8 [08:07]
TideFN [TideFN!~TideFN@2601:cb:8280:9520:ec91:a27b:672f:c386] has joined ##java [08:07]
Maldivia (or more precisely, Weld3 is CDI 2, and Weld4 is CDI 3) [08:07]
seschwar [seschwar!~seschwar@unaffiliated/seschwar] has joined ##java [08:08]
mitch0 hrmp. I broke my idea... it doesn't show differences between actual and expected results in tests any more :( [08:08]
rwheadon [rwheadon!] has joined ##java [08:12]
dendazen [dendazen!] has joined ##java [08:12]
chewb its using weld3 according to test output, should it use weld2? [08:14]
chewb INFO: WELD-000900: 3.1.6 (Final) [08:14]
mbooth lucifer: Solid satire [08:17]
Sheilong [Sheilong!uid293653@gateway/web/] has joined ##java [08:17]
Maldivia chewb: well, the NoClassDefFoundError: jakarta/enterprise/inject/spi/BeanManager suggests SOMETHING is expecting CDI3 -- so probably a wrong dependency or something [08:17]
chewb no. After changing dep versions to 2.4.1Final i get different kind of error ava.lang.NoSuchMethodError: javax.enterprise.inject.spi.ObserverMethod.getPriority()I [08:18]
chewb so javaee implementation, weld used is still 3 [08:18]
AndroidDAW [AndroidDAW!] has joined ##java [08:18]
Maldivia well, if you have an explicit weld dependency, make sure that the weld-junit dependency you have matches, so they use the same version [08:20]
Maldivia this is dependency management 101 [08:20]
chewb weld-junit5 must be 3 too? [08:20]
Maldivia check its transitive dependencies [08:21]
Maldivia weld-junit5 2.0.2.Final uses Weld 3.1.6.Final [08:21]
chewb ok, i changed something now your test works, mine still does not because of "unsatisfied dependencies" [08:22]
chewb Unsatisfied dependencies for type ReportFacade with qualifiers @Default. But i dont use ReportFacade in my test, so thats weird for me [08:23]
CombatVet [CombatVet!~c4@gateway/tor-sasl/combatvet] has joined ##java [08:23]
Maldivia well, something you use uses it [08:23]
dqx [dqx!~dqx@unaffiliated/dqx] has joined ##java [08:24]
dqx [dqx!~dqx@unaffiliated/dqx] has joined ##java [08:26]
chewb Unsatisfied dependencies for type InsuranceCompanyReportDao with qualifiers @Default" But i added this class to beanClasses [08:29]
adadelta Anyone here deployed Spring apps on Pivotal Web Services? First time deploying by myself on the cloud (side project) and it seems to be much easier than AWS [08:34]
zeden [zeden!~user@unaffiliated/zeden] has joined ##java [08:35]
Maldivia adadelta: well, they are specifically geared towards deploying spring boot apps there, they have built in support for it in the maven plugin etc :D [08:37]
black_ant [black_ant!~antilope@unaffiliated/black-ant/x-1505394] has joined ##java [08:37]
Maldivia adadelta: it's almost as if it's the same company behind it all and they have an incentive to make it easy :D [08:38]
dreamreal Pivotal should buy spring [08:38]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [08:38]
retroguy8000 [retroguy8000!~retroguy8@] has joined ##java [08:38]
cheeser or at least hire most of the devs [08:38]
KidBeta_ [KidBeta_!~Kidbeta@hpavc/kidbeta] has joined ##java [08:41]
archer121 parted the channel: [08:43]
jadesoturi [jadesoturi!~jadesotur@unaffiliated/kfj] has joined ##java [08:43]
adadelta Maldivia: Yup, I knew that, and looking through the docs it seems to make life easier for cloud-clueless people like me to deploy [08:45]
Maldivia adadelta: ... and then the bill comes :D [08:45]
Jonopoly [Jonopoly!~Jonopoly@unaffiliated/jonopoly] has joined ##java [08:45]
mbooth hopes there's a duck behind that bill [08:46]
adadelta oooor, can scrap that idea altogether [08:47]
adadelta "We have decided to prioritize investment in other areas of our business, and are announcing the end of availability (EOA) for Pivotal Web Services, effective as of January 15, 2021" [08:47]
wedr [wedr!] has joined ##java [08:47]
Maldivia aka today :D [08:48]
dreamreal it might be worthwhile these days to host your own infrastructure anyway [08:48]
Diablo-D3 heh I wonder if the future of the web is just moving to lambda-ish design not on the cloud at all [08:49]
Diablo-D3 you just assemble your own cloud automatically [08:49]
dreamreal has to run somewhere though [08:49]
Maldivia but it's serverless! :D [08:50]
Diablo-D3 yeah, you go back to the rent a dedi model [08:50]
dreamreal tim berners-lee is working on that, apparently [08:50]
adadelta I saw this announcement on another website though, nothing on their website though. I guess it's an old announcement that was rolled back, dosen't give me confidence though [08:50]
mbooth Haha, "serverless" makes me laugh every time [08:50]
adadelta I'll add another though there just for fun [08:50]
Diablo-D3 I can trust companies to sell me a dedi (hell, I run a company that does that, lots of ex-aws customers that wizened up on that) [08:50]
dreamreal a lot of trusted providers have kind of abrogated their usefulness in the past week [08:50]
dreamreal it's understandable but stupid [08:50]
Diablo-D3 but Programming is Hard(tm), according to frontend devs, so... [08:51]
Maldivia adadelta: it's in the FAQ: [08:51]
Maldivia Maldivia's title: "Pivotal Web Services | FAQ" [08:51]
adadelta ahh ok :( [08:52]
Maldivia adadelta: but with CLI tools, it's generally quite easy -- Microsoft also supports Spring Boot easily - [08:53]
Maldivia Maldivia's title: "Quickstart - Deploy your first Azure Spring Cloud application | Microsoft Docs" [08:53]
Maldivia adadelta: they even have an IntelliJ plugin, so you just click "Deploy" [08:54]
dreamreal and MS has a reputation for being trustable and reliable, just like AWS [08:54]
Diablo-D3 tbf I consult for customers that are on clouds, and Ive had far less azure issues than aws issues [08:55]
Diablo-D3 otoh they're still both lightyears ahead of goog cloud, jesus christ I wont even consult for them unless the job is "help me get off goog cloud" [08:55]
Maldivia it's not like every single IOS device stops working just because AWS has problems... ohh wait [08:56]
Diablo-D3 yeah, uh, wtf apple, why the fuck are you even using a single actual concrete cloud here [08:57]
mbooth Concrete cloud [08:57]
Diablo-D3 just fucking buy capacity everywhere [08:57]
Maldivia Diablo-D3: not iOS -- Internet-of-shit devices :D [08:57]
Diablo-D3 if I ever "do the cloud" I swear its going to be a virtual cloud product [08:57]
Diablo-D3 I just buy VMs everywhere [08:57]
Diablo-D3 someones gotta already do this [08:58]
Diablo-D3 api that just proxies everybody else's apis, and they take like a 10% fee or something [08:58]
Maldivia Diablo-D3: so yeah, should have written IoT I guess :D [08:59]
mbooth Diablo-D3: Isn't this what "multicloud" is? [09:00]
Maldivia (internet-of-shit is just stick in my head) [09:00]
Diablo-D3 mbooth: I know of companies that do that, but they internally proxy it [09:00]
mbooth Diablo-D3: I know it's something RH bang on about from time to time: [09:00]
mbooth But, I'm pretty cloud-ignorant tbh [09:01]
Diablo-D3 Im cloud semi-competent, but its mostly because I have to deal with customers who use the cloud [09:01]
Diablo-D3 if you threw me in the deep end of the pool of, say, a netflix engineering job, I'd probably drown the first few weeks [09:01]
dqx [dqx!~dqx@unaffiliated/dqx] has joined ##java [09:08]
_lucifer [09:27]
_lucifer TIL, this is valid java! [09:27]
conan [conan!] has joined ##java [09:27]
Maldivia receiver type [09:28]
_lucifer yeah, just discovered that :) [09:28]
Maldivia allows you to add annotations [09:29]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [09:35]
plarsen [plarsen!~plarsen@redhat/jboss/pdpc.professional.plarsen] has joined ##java [09:38]
Matthijs [Matthijs!~quassel@unaffiliated/matthijs] has joined ##java [09:45]
conan [conan!] has joined ##java [09:51]
peaceguy [peaceguy!~peaceguy@unaffiliated/peaceguy] has joined ##java [09:55]
bolovanos_ [bolovanos_!~bolovanos@unaffiliated/bolovanos] has joined ##java [09:56]
Sgeo [Sgeo!] has joined ##java [09:59]
cheeser Maldivia: dmlloyd: is there anything in asm that will decode a bytecode back to its name? e.g., 182 -> INVOKEVIRTUAL ? [10:00]
Maldivia cheeser: I've usually just had a lookup table for that myself :D [10:02]
cheeser yeah. easy enough to build but ... [10:02]
cheeser i'm writing unit tests to validate some code gen... [10:02]
Maldivia cheeser: what are you trying to do ? :D [10:02]
Maldivia ah ok [10:02]
cheeser <fap/> [10:02]
Maldivia just run it through the tracer? [10:03]
cheeser the what? [10:03]
Maldivia ASM's javap [10:03]
Maldivia TraceClassVisitor [10:03]
MarkyC [MarkyC!] has joined ##java [10:04]
cheeser twitches [10:04]
cheeser this ... could work... [10:05]
Maldivia cheeser: actually Printer.OPCODES[opcode] [10:05]
Maldivia org.objectweb.asm.util.Printer, that is [10:05]
cheeser this could really simplify what I'm doing actually. i know what the bytecode should look, so I can just declare a String to compare against. [10:06]
Maldivia and it would be "human-readable" [10:06]
cheeser yep. and more importantly, maintainable. [10:07]
sbalmos screw maintainable [10:07]
Diablo-D3 ponders what java would look like if it was written like idiomatic forth [10:08]
cheeser so in theory, during generation, i could wrap this Tracer bit around the actual CV doing the generate and get both the bytecode and the debug output, yeah? [10:08]
Maldivia cheeser: and are you using Java 15? then Text Blocks! [10:08]
Maldivia yep [10:08]
cheeser Maldivia: technically still 8 [10:08]
dmlloyd yeah I use a lookup table too [10:09]
Maldivia jabel [10:09]
Maldivia Jabel is a javac compiler plugin that lets you use modern Java 9-14 syntax when targeting Java 8. [10:09]
cheeser dmlloyd: can you imagine stuart's and emmanuel's reaction to suggesting using jabel? :D [10:09]
dmlloyd yeah they wouldn't be in favor [10:09]
dmlloyd for different reasons :) [10:10]
cheeser that's putting it mildly [10:10]
Maldivia heheh [10:10]
Maldivia just commit it, and see if it passes inspection :D [10:10]
kupi [kupi!uid212005@gateway/web/] has joined ##java [10:19]
Maldivia cheeser: I have this for my Opcodes lookup table -- :D Used for "decompiling" verify error bytecode dumps :) [10:24]
cheeser and that will dump a whole class? [10:25]
Maldivia no, that just dumps the method -- the verify error only has the method Code block in the message, no constant pool etc [10:26]
cheeser nods. [10:26]
Maldivia cheeser: the example bytecode in the paste produces this output: [10:27]
Maldivia Maldivia's title: "dpaste/tayL (Plain Code)" [10:27]
cheeser nice [10:27]
Maldivia you kind of need to have an idea of what the class does in order to figure out what's happening etc :D [10:27]
r0shi [r0shi!~r0shi@2001:8a0:b964:1300:95d1:eb1:d735:6117] has joined ##java [10:28]
caffery [caffery!tuco@gateway/shell/xshellz/x-uypduxntcaqwjogh] has joined ##java [10:28]
xekz [xekz!~kexmex@unaffiliated/kexmex] has joined ##java [10:31]
cheeser pfft. TraceClassVisitor is final. trying to capture individual methods... [10:32]
r0shi [r0shi!~r0shi@2001:8a0:b964:1300:95d1:eb1:d735:6117] has joined ##java [10:33]
Maldivia cheeser: TraceMethodVisitor for that particular method then [10:33]
cheeser just have to figure out how/where to wire that in [10:34]
cheeser i'll try it by overriding ClassNode.visitMethod() [10:36]
runlevel7__ [runlevel7__!runlevel7@gateway/vpn/privateinternetaccess/runlevel7] has joined ##java [10:42]
stryek [stryek!uid332574@gateway/web/] has joined ##java [10:44]
dqx [dqx!~dqx@unaffiliated/dqx] has joined ##java [11:03]
peaceguy [peaceguy!~peaceguy@unaffiliated/peaceguy] has joined ##java [11:05]
Smigwell [Smigwell!] has joined ##java [11:14]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [11:19]
nspurgetis [nspurgetis!~nspurgeti@2600:1702:1bd0:5140:b5fe:216:b1d9:96d] has joined ##java [11:49]
georgios [georgios!~george@unaffiliated/anaphaxeton] has joined ##java [11:50]
fargos [fargos!~kvirc@] has joined ##java [11:52]
HaniiLaptop [HaniiLaptop!] has joined ##java [11:53]
fargos Hi, my program should use a library if it can load it, or do something else if it cannot find it. So I have a class where one method needs to do something else in this case. But I need to have an object available everywhere in the class that references that maybe not existing library: - how do I solve this? [11:58]
HaniiLaptop It's not adhering to the contract for Comparable, but is this a valid way to use comparable with Assert4J's assertions? I'm thinking about how I'd use the "Contains Elements Of" assertions for collections of objects of a type that doesn't have any kind of obvious applicable order. [11:58]
xekz [xekz!~kexmex@unaffiliated/kexmex] has joined ##java [12:00]
_noblegas [_noblegas!uid91066@gateway/web/] has joined ##java [12:00]
mbooth serviceloader [12:00]
mbooth fargos, spi is Service Provider Interface. Lets you drop a small text file into a jar saying "I have a class that implements this interface", then use java.util.ServiceLoader at runtime to find all implementations of that interface. See for an intro and to make creating the service files much simpler. [12:00]
retroguy8000 [retroguy8000!~retroguy8@] has joined ##java [12:00]
mbooth fargos: That's the common way to make extensible applications [12:01]
conan [conan!] has joined ##java [12:02]
ib07 [ib07!] has joined ##java [12:04]
fargos Ok I'll have a look and try to understand it (I'm somewhat of a beginner), thank you :) [12:06]
average [average!uid473595@gateway/web/] has joined ##java [12:09]
Nightwing52 [Nightwing52!~Thunderbi@] has joined ##java [12:10]
nspurgetis I'm using apache poi-ooxml in my project to output some data to MS Word and Excel. When I run my project with `gradlew run`, both the Word and Excel features work fine. However, when I run the image (generated by the beryx runtime plugin), the Word feature works, but not Excel! i'm not finding error messages or helpful logging output anywhere. I'm really not sure why. At first, I thought it might [12:18]
nspurgetis have something to do with something not getting put on the image's classpath/module path but because the Word part works, that seems unlikely. [12:18]
nspurgetis Any idea what the problem might be, or on how to at least get some sort of useful error message? When I click the button in my application that is supposed to open the data in an Excel spreadsheet, Excel doesn't open, I just get the loading animation in my application forever. But again, it works (Excel opens almost instantly, data is displayed) when I run the project directly using gradle [12:19]
hotcoffee [hotcoffee!~hotcoffee@] has joined ##java [12:22]
gelignite [gelignite!] has joined ##java [12:37]
gareppa [gareppa!~gareppa@unaffiliated/gareppa] has joined ##java [12:41]
dqx [dqx!~dqx@unaffiliated/dqx] has joined ##java [12:49]
ebullient As a super nerdy developer/engineer, the term "solution" has started to give me hives. [12:51]
ebullient nevermind. ;) [12:51]
ebullient that was meant for somewhere else. Damn windows. [12:51]
ebullient TOOOOOO MANY OF THEM. As you were. [12:52]
dreamreal hands ebullient a cookie [12:52]
ebullient YAAS. thanks. ;) [12:52]
masticass [masticass!] has joined ##java [12:54]
MrFlibble [MrFlibble!Rimmer@] has joined ##java [12:55]
bolovanos__ [bolovanos__!~bolovanos@unaffiliated/bolovanos] has joined ##java [12:56]
hschmale [hschmale!] has joined ##java [01:01]
conan [conan!] has joined ##java [01:04]
led1 [led1!~Thunderbi@] has joined ##java [01:06]
svm_invictvs Fuck me I'm stupid. I spend all this time sifting the heap w/ a bunch of tostring nonsense in intellij only to realize that the reason I couldn't find the objecvt because it wasn't there [01:08]
masticass [masticass!] has joined ##java [01:10]
wordsToLiveBy [wordsToLiveBy!~wordsToLi@unaffiliated/wordstoliveby] has joined ##java [01:10]
g00s [g00s!~g00s@unaffiliated/g00s] has joined ##java [01:12]
dqx [dqx!~dqx@unaffiliated/dqx] has joined ##java [01:12]
CombatVet [CombatVet!~c4@gateway/tor-sasl/combatvet] has joined ##java [01:16]
varaindemian_ [varaindemian_!~varaindem@] has joined ##java [01:20]
Steeve [Steeve!~steve@unaffiliated/steeve] has joined ##java [01:20]
ernimril [ernimril!] has joined ##java [01:29]
Enissay [Enissay!~Enissay@unaffiliated/enissay] has joined ##java [01:32]
rwheadon [rwheadon!] has joined ##java [01:44]
Enissay [Enissay!~Enissay@unaffiliated/enissay] has joined ##java [01:49]
hnOsmium0001 [hnOsmium0001!uid453710@gateway/web/] has joined ##java [01:49]
sbalmos Is that the infamous ObjectsInMirrorAreNotWhatTheyAppearException? [02:10]
Enissay [Enissay!~Enissay@unaffiliated/enissay] has joined ##java [02:10]
ricky_clarkson We all go through versions of that, running the debugger against the wrong program/test, looking at the wrong output file, etc. [02:13]
hd1 [hd1!6bb8e407@gateway/web/cgi-irc/] has joined ##java [02:14]
KeRT [KeRT!~UnFaQ@unaffiliated/trek] has joined ##java [02:16]
Diablo-D3 [02:25]
Diablo-D3 Diablo-D3's title: "[SECURITY] CVE-2021-24122 Apache Tomcat Information Disclosure" [02:25]
hotcoffee Diablo-D3: tomcats running on windows? [02:31]
ib07 [ib07!] has joined ##java [02:33]
Salatwurzel [Salatwurzel!~user@2a02:810d:8fbf:c258:eccd:3ef4:d818:4cda] has joined ##java [02:35]
Enissay [Enissay!~Enissay@unaffiliated/enissay] has joined ##java [02:39]
Kol [Kol!] has joined ##java [02:52]
Enissay [Enissay!~Enissay@unaffiliated/enissay] has joined ##java [02:57]
Diablo-D3 hotcoffee: ikr? [03:00]
AndroidDAW [AndroidDAW!] has joined ##java [03:01]
yawkat [yawkat!] has joined ##java [03:05]
pi0 [pi0!zeropi@gateway/shell/xshellz/x-kjuotzcixjkrmtrx] has joined ##java [03:05]
pi0 thank goodness hw help here ;[ [03:06]
deavmi [deavmi!~tbk@2a04:5b81:2010::33] has joined ##java [03:08]
sa02irc [sa02irc!] has joined ##java [03:14]
hotcoffee Diablo-D3: right. I imagine the scenario in which they found it. But it is always good to know, specially if you mess around with nfs. [03:17]
emx [emx!~bemx@2001:1715:4e24:efd0:f05d:234f:9370:5805] has joined ##java [03:26]
emx Does an app with embedded tomcat and enabled SSL require a keystore if the app is running behind a proxy that has the SSL certificate for the external domain? [03:28]
Maldivia emx: yes [03:29]
Maldivia emx: but if you're running behind a proxy, then it's often because the tomcat (in this case) is running http and not https [03:29]
emx Maldivia, I want the app to use https. [03:30]
Maldivia then you need a certificate on the server, of course [03:30]
dreamreal hands emx nginx [03:30]
hotcoffee emx: then you need to trust the proxy server. [03:30]
emx hotcoffee, regarding connections from outside, I assume? [03:31]
Nahra [Nahra!~Nahra@unaffiliated/nahra] has joined ##java [03:31]
emx dreamreal, are there any conceptual advantages using nginx instead of apache? [03:31]
Maldivia emx: your tomcat needs to have a certificate that the proxy server trusts, because the proxy server is going to have to decrypt and reencrypt the data stream (or have access to the same private key as the server for a "man-in-the-middle" peak) [03:31]
dreamreal nah [03:32]
hotcoffee emx: if you need to tunnel the external https connection, there is a whole other scenarios. [03:32]
emx Maldivia, so what I would need is a certificate with alias localhost (given the service is reachable under the respective localhost/port combination)? [03:33]
Maldivia a publically trusted cert with alias localhost is impossible to get [03:33]
emx hotcoffee, the data-flow of a request is as follows: external client ? proxy ? service. Every transmission is secured with SSL. [03:34]
hotcoffee Maldivia: hopefully ;) [03:34]
Maldivia emx: have a self-signed cert on the service, and have the proxy trust that cert [03:34]
Maldivia hotcoffee: impossible... I don't even want to think of the consequences if it was possible :D [03:35]
Maldivia [fingers in ears, la la la la la, I don't hear anything, la la la la, impossible] [03:36]
emx Maldivia, so the summary of the simplest scenario is: have a self-signed certificate with alias localhost having the certificate in the "trust-store" of the proxy? [03:36]
Maldivia emx: for instance, yes [03:36]
emx So I don't need the host's default (and probably partially outdated) keystore? [03:37]
Maldivia but why even bother with https connection if you're connecting over loopback device ? [03:37]
emx paranoia? [03:37]
Maldivia well, someone needs to have root access on that machine to intercept that data anyway... at which point they would also have access to your private key and can easily decrypt the traffic anyway, so it provides zero security at that point [03:39]
emx Maldivia, So you say that I have to trust myself? Quite a challenge. [03:44]
hotcoffee emx: besides the no-gain on security side, you will increase CPU usage with something kinda useless. [03:44]
Nightwing52 [Nightwing52!~Thunderbi@] has joined ##java [03:48]
freeone3000 I'd like to offer a counterpoint. Lots of browser functionality is restricted to HTTPS over HTTP, for better or worse. The proper way is to self-sign a cert, trust that cert, and use that cert. Assign a non-localhost hostname to your loopback address. This will allow local and remote to work identically, in a trusted environment. [03:48]
cheeser +1 [03:48]
Maldivia or depending what the proxy server is for, if it's just load balancing, set it in ssl passthru modr [03:50]
Maldivia freeone3000: or use the same cert, and have the hostname of the machine pointing to localhost as well [03:51]
Maldivia (like have a name server that serves the local IPs for the servers, even though they have a global ip as well, so you can access them directly on local network) [03:53]
hotcoffee freeone3000: for development purposes, sure, but in a production (non-thrid-party-cloud) environment (rare), properly configured (rarer), it's a waste of resources encrypt between proxy and backend server. [03:55]
hotcoffee But I guess we are drifting from the channel topic. [03:56]
freeone3000 hotcoffee: You might be interested in reading about defense-in-depth strategies. Perimeter defense is generally considered outmoded. [03:56]
FabioP [FabioP!] has joined ##java [03:59]
hotcoffee freeone3000: Thanks, I will out of curiosity. I suppose it would be renamed by emx to paranoid-defense strategies. ;) But I keep thinking this is a off-topic discussion. [04:00]
moldorcoder7 [moldorcoder7!~moldorcod@] has joined ##java [04:01]
emx Let's get on-topic again: Is there an application/profile/lable combination that exports the of the spring cloud configuraiton server? It feels wrong to specify datasource twice. But maybe it's a bad idea to have the properties table in the same database as production data? [04:03]
moldorcoder7 [moldorcoder7!~moldorcod@] has joined ##java [04:22]
cliluw [cliluw!~cliluw@unaffiliated/cliluw] has joined ##java [04:23]
orbyt_ [orbyt_!~orbyt@] has joined ##java [04:24]
morfin [morfin!~morfin@] has joined ##java [04:31]
morfin hello again. I can directly cast PointerByReference to an object of type T stored in there? [04:32]
cader [cader!~user@2601:601:907f:51f0:d600:59c5:782a:2c09] has joined ##java [04:35]
kirua [kirua!~kirua@unaffiliated/kirua] has joined ##java [04:36]
Maldivia no [04:37]
cheeser wtf is PointerByReference? [04:43]
Maldivia JNI [04:44]
cheeser ah [04:44]
Maldivia a class that represents a void** [04:44]
cheeser thankfully almost 0 experience there. what little experience i have there is that I once looked at such code at a job 20 years ago. [04:44]
Maldivia but regardlessly, it's a java class, so can ofcourse not be cast to T :D [04:45]
cheeser regardlessly, eh? [04:46]
ron he means, irregardless [04:47]
kspalaiologos [kspalaiologos!~palaiolog@] has joined ##java [04:48]
Maldivia as in "doesn't matter if its JNI or not, it's a Java class, and of course it cannot be cast to something else that's not in its type hierarch" [04:50]
Maldivia y [04:50]
cheeser D [04:51]
Maldivia regardlessly/irregardless if the correct word is irregardless, regardless, regardlessly, or something else [04:51]
cheeser D [04:52]
computeiro [computeiro!~Wender@] has joined ##java [04:54]
muhaha [muhaha!59b10c98@gateway/web/cgi-irc/] has joined ##java [05:04]
kirua [kirua!~kirua@unaffiliated/kirua] has joined ##java [05:06]
hotcoffee parted the channel: "be safe." [05:07]
kirua [kirua!~kirua@unaffiliated/kirua] has joined ##java [05:12]
mindCrime [mindCrime!] has joined ##java [05:13]
ron did you mean irregardlessy? [05:14]
Maldivia "or something else" [05:18]
ron D [05:18]
morfin Oh damn it's more complicated) [05:20]
qilx [qilx!~quassel@] has joined ##java [05:20]
morfin Basically i am trying to extract element text while using library working with ui automation via COM with JNA that seems to be using JNI(?) [05:22]
Maldivia ah yeah, the above class is JNA, not JNI -- anyway, same things apply :D [05:22]
Maldivia morfin: a PointerByReference is just a Pointer, you have no way of knowing what is is -- now, the Pointer class has a lot of method for reading from that memory location though [05:23]
Maldivia morfin: do you happen to know what the actual type is? [05:24]
morfin Yes [05:24]
Maldivia and what is the actual type? [05:25]
morfin mmarquee.automation.pattern.Text i think [05:26]
Maldivia so that's a Java class -- why are you getting that via JNA? isn't there some Java API to get it? [05:27]
deavmi [deavmi!~tbk@] has joined ##java [05:27]
morfin nvm seems like i managed to go other way :) I am just checking if pointer is not null and doing pattern = Text(element) and then pattern.value [05:29]
Maldivia ok, because a pointer to a java object in memory is ... well, temporary -- by the time the jna call returns it could very well have been moved somewhere else in memory by the GC [05:30]
morfin He-he you can have an Element instance that have pointer to lower level structures and if it's gone and you refer it BOOM! NullPointerException [05:31]
nickb [nickb!sid293439@gateway/web/] has joined ##java [05:38]
noahmg123 [noahmg123!sid89117@gateway/web/] has joined ##java [05:39]
katana [katana!~katana@unaffiliated/katana] has joined ##java [05:41]
chris64 [chris64!~chris@unaffiliated/chris64] has joined ##java [05:46]
dec0d3r [dec0d3r!~dec0d3r@2001:8003:4824:7000:c786:e7d2:abcd:40ab] has joined ##java [05:47]
bolovanos_ [bolovanos_!~bolovanos@unaffiliated/bolovanos] has joined ##java [05:56]
maciuszek [maciuszek!sid246459@gateway/web/] has joined ##java [05:58]
DJ_Dichotomy [DJ_Dichotomy!~DJ_Dichot@] has joined ##java [05:58]
canton7 [canton7!canton7@about/csharp/regular/canton7] has joined ##java [05:58]
r0bby [r0bby!sid699@guifications/user/r0bby] has joined ##java [05:59]
ffwacom [ffwacom!sid36937@gateway/web/] has joined ##java [05:59]
Lightsword [Lightsword!~Lightswor@2604:a880:1:20::1d3:9001] has joined ##java [05:59]
beaky [beaky!~beaky@2a03:b0c0:0:1010::17cf:7003] has joined ##java [06:00]
pingveno [pingveno!sid269408@gateway/web/] has joined ##java [06:01]
rann [rann!sid175221@gateway/web/] has joined ##java [06:02]
graphicsv [graphicsv!sid340368@gateway/web/] has joined ##java [06:02]
LtHummus [LtHummus!~lthummus@] has joined ##java [06:04]
zeden [zeden!~user@unaffiliated/zeden] has joined ##java [06:07]
zeden [zeden!~user@unaffiliated/zeden] has joined ##java [06:11]
kirua [kirua!kirua@unaffiliated/kirua] has joined ##java [06:11]
Deeewayne [Deeewayne!~dwayne@2605:a601:a816:5000:f7ce:535c:c78:9ec3] has joined ##java [06:17]
Nahra [Nahra!~Nahra@unaffiliated/nahra] has joined ##java [06:20]
cruxeternus [cruxeternus!] has joined ##java [06:21]
Maldivia [Maldivia!] has joined ##java [06:21]
daseiboshi [daseiboshi!] has joined ##java [06:21]
Maxdamantus [Maxdamantus!~Maxdamant@unaffiliated/maxdamantus] has joined ##java [06:21]
Papa [Papa!~papa@unaffiliated/papa] has joined ##java [06:21]
pioto [pioto!~pioto@unaffiliated/pioto] has joined ##java [06:21]
ornxka [ornxka!~ornxka@unaffiliated/ornx] has joined ##java [06:21]
Papa [Papa!~papa@unaffiliated/papa] has joined ##java [06:21]
kashike [kashike!kashike@unaffiliated/kashike] has joined ##java [06:21]
rorx [rorx!] has joined ##java [06:22]
Orphis [Orphis!] has joined ##java [06:25]
Nahra [Nahra!~Nahra@unaffiliated/nahra] has joined ##java [06:25]
hsiktas[m] [hsiktas[m]!hsiktasmat@gateway/shell/] has joined ##java [06:28]
AAC [AAC!] has joined ##java [06:41]
AAC hey. How do i store a number larger than Double.MAX_VALUE [06:41]
fax [fax!~quassel@unaffiliated/fax] has joined ##java [06:42]
fizzie As a java.math.BigInteger, possibly. Or a BigDecimal if it's not an integer. [06:44]
AAC ok thks [06:44]
acolarh [acolarh!] has joined ##java [06:46]
MarkyC [MarkyC!] has joined ##java [07:03]
AAC [AAC!] has joined ##java [07:06]
db [db!uid18678@gateway/web/] has joined ##java [07:07]
rzjian [rzjian!~l@] has joined ##java [07:33]
glowdemon1 [glowdemon1!] has joined ##java [07:39]
glowdemon1 [glowdemon1!] has joined ##java [07:40]
veegee [veegee!] has joined ##java [07:48]
orbyt_ [orbyt_!~orbyt@] has joined ##java [07:53]
svm_invictvs Did they remove the frames option from javadocs? [08:01]
javango [javango!~javango@] has joined ##java [08:03]
irrgit [irrgit!~ch33se@] has joined ##java [08:05]
Goplat [Goplat!~Goplat@reactos/developer/Goplat] has joined ##java [08:21]
dqx [dqx!~dqx@unaffiliated/dqx] has joined ##java [08:22]
hammond [hammond!proscan@gateway/shell/insomnia247/x-gvfdwchuguujsesl] has joined ##java [08:28]
linext [linext!] has joined ##java [08:30]
hammond hi, im getting Exception in thread "main" java.lang.IllegalArgumentException: Comparison method violates its general contract! for doing [08:30]
dendazen [dendazen!] has joined ##java [08:36]
fizzie No idea exactly why, but using `Comparator.comparing(Record::getRSquared).reversed()` instead of your own implementation would presumably meet all the requirements. [08:39]
AAC Byte a = 98; a+= 2; compile error [08:40]
AAC a++ works [08:40]
AAC a++ not equal to a+=1 ? [08:41]
fizzie Not entirely, thanks to types & narrowing conversions not being permitted implicitly. `a = (byte)(a + 2)` will work again, for example. [08:42]
AAC why does a++ works? [08:44]
AAC another question, in the api of "System.identityHashCode(a)" says "Returns the same hash code for the given object as would be returned by the default method hashCode()" . On my class, an object hashCode() different from System.identityHashCode [08:46]
AAC also...Ssystem.identityHashCode, returns always the same values :/ [08:47]
AAC lots of questions :/ [08:47]
AAC like it should change references right [08:47]
AAC address i mean [08:47]
AAC im just asking, because i want to know if they are bugs... [08:48]
fizzie `a++` works because it's specifically permitted to do a narrowing conversion; I guess because what you'd expect to happen with a++ is to "stay in the type" it's in. [08:49]
fizzie ("-- the value 1 is added to the value of the variable and the sum is stored back into the variable. Before the addition, binary numeric promotion (5.6) is performed on the value 1 and the value of the variable. If necessary, the sum is narrowed by a narrowing primitive conversion (5.1.3) and/or subjected to boxing conversion (5.1.7) to the type of the variable before it is stored.") [08:49]
fizzie Since you were using a `Byte`, boxing might be involved too, but I don't want to think it through. [08:50]
fizzie And for System#identityHashCode, I think you might need a testcase to explain what the problem seems to be. Certainly it works as expected in something like [08:51]
fizzie (Returns the same as Object#hashCode(), and a different value for different objects.) [08:52]
luxemboye [luxemboye!~luxemboye@gateway/tor-sasl/luxemboye] has joined ##java [08:54]
_lucifer AAC: why are you using System.identityHashCode in the first place? [08:59]
AAC hold on reading :) [08:59]
deavmi [deavmi!~tbk@2a04:5b81:2010::33] has joined ##java [09:00]
Maldivia AAC: identityHashCode is NOT address -- it's hashCode, that (by default, can be overriden by JVM flag) is a PRNG [09:01]
AAC yes but shouldnt they be the same? [09:01]
Maldivia AAC: so for the entirety of an object's lifetime it will ALWAYS return the same [09:01]
AAC that's what the api says [09:01]
Maldivia AAC: it returns the same as hashCoe does if it's NOT overriden [09:01]
AAC i didnt override it [09:02]
Maldivia Object o = new Object(); o.hashCode() == System.identityHashCode(o); [09:02]
Maldivia String str = "Hello World"; str.hashCode() != System.identityHashCode(str); [09:03]
Maldivia because String has its own implementation of hashCode [09:03]
AAC and Byte? [09:03]
Maldivia Byte also overrides hashCode,yes [09:03]
AAC oh ok [09:03]
AAC that was it [09:03]
Maldivia most things do [09:04]
Maldivia Byte.hashCode == byte value [09:04]
Maldivia same for all the integer types (Long being an xor of the high 32bit and low 32bit) [09:04]
AAC Returns the same hash code for the given object as would be returned by the default method hashCode(), whether or not the given object's class overrides hashCode(). The hash code for the null reference is zero. [09:05]
AAC "wheter or not the given object's class overrides..." [09:05]
fizzie Yes, it returns what hashCode() would have if you hadn't overridden it, whether or not the given object's class actually did so. [09:06]
Maldivia exactly -- the default being the one implemented on Object itself -- meaning it's as if you could call the hashCode on Object directly, disregarding polymorphism/overriden methods [09:06]
fizzie All the 256 possible different Byte objects (when obtained via Byte#valueOf, possibly also via boxing) are also also cached, so if they have the same value, they wouldn't have a different address either. You'd only get a different object if you specifically made one. [09:07]
Maldivia fizzie: boxing uses valueOf, so [09:07]
fizzie Right. [09:07]
AAC "if you hadn't overridden it", you mean myself? [09:08]
fizzie Well, if the class hadn't. [09:08]
fizzie Someone else did it for Byte. [09:08]
Maldivia AAC: ANYWHERE in the class's hierarchy [09:08]
fizzie Here's another one of those examples: [09:09]
fizzie (The last one ends up being a different object because `new Byte(...)` can't do anything else.) [09:10]
AcTiVaTe [AcTiVaTe!] has joined ##java [09:10]
Maldivia AAC: as for the compound addition above -- T a; a += x; <-- this is equivalent to T a; a = (T)(a + x); [09:11]
AAC ok so if the Byte class, doesnt overwrite hashcode, what is the default method ? [09:11]
Maldivia javadoc Object.hashCode() [09:11]
Maldivia Maldivia: [JDK: java.lang.Object#hashCode()] [09:11]
Maldivia that one [09:11]
AAC so it transvesre the call hierachy [09:12]
AAC right? [09:12]
AAC looking for hash code [09:12]
Maldivia your example Byte a = 98; a += 2; --- that becomes (after unboxing): a = (Byte)(a.byteValue() + 2); <-- addition in itself produces an int, it it's like: int tmp = a.byteValue() + 2; a = (Byte)tmp; <-- and this is where you get your error, since int cannot be autoboxed to Byte, it boxes to Integer [09:13]
Maldivia AAC: doesn't traverse call hierarchy, it looks in the class hierarchy [09:14]
AAC sorry that :) [09:14]
AAC i get it..then why a++ works? [09:14]
AAC yes ive tried with Integer and works :) [09:15]
Maldivia because ++ has different scematics :D [09:15]
AAC D [09:15]
Maldivia ++ doesn't widen to int, it stays the same type [09:15]
AAC and a+= 1 ? [09:16]
AAC isnt that the same [09:16]
Maldivia no -- since that follows the rules of the compound operator, meaning type widening [09:17]
AAC oh i see [09:17]
AAC thansk [09:17]
AAC )) [09:17]
AAC but doesnt need to access the a? [09:19]
Maldivia a += b => a = (AType)(a + b); [09:20]
Maldivia a++ => a = (AType)(a + (AType)1); -- but in case of boxed type: a = (AType)(APrimitiveType)(a.unbox() + (APrimitiveType)1); [09:20]
Maldivia the type narrowing BEFORE the case to the boxed type is what makes all the difference [09:21]
Maldivia and yes, it is kind of idiotic that a++ works but a+= 1 doesn't [09:21]
AAC hmmm [09:22]
Maldivia but on the other hand a = a + 1; doesn't work either, neither does a = (Byte)(a + 1); you need: a = (Byte)(byte)(a + 1); [09:22]
Maldivia (where a is Byte) [09:22]
AAC so technically ++ doesnt check types, so how does it sum [09:22]
Maldivia it DOES check the type [09:23]
Maldivia but it just allows for silently boxing and unboxing it as well, preserving the type after the addition [09:23]
ricky_clarkson Conceptually a++ where a is a byte is the same as a = (byte)(a + 1) as far as I know [09:23]
ricky_clarkson There's no need to check a type, it's known at compile time. [09:24]
Maldivia ricky_clarkson: (byte)(a + (byte)1); [09:24]
ricky_clarkson Maldivia: + promotes to int anyway, so aren't those the same as each other? [09:24]
Maldivia ricky_clarkson: technically, but d++; is (d + (double)1) [09:25]
Maldivia ricky_clarkson: the thing to notice about ++ and -- is that they do narrowing primitive conversion BEFORE boxing conversion [09:27]
AAC so hashcode() calls Byte.hashcode(), or other? [09:28]
_lucifer beginning java 16, null friendly immutable lists [09:28]
_lucifer `` [09:28]
Maldivia AAC: hashCode calls the most specialized version of that method based on the dynamic type of the target object it's called on [09:30]
Maldivia like any other public/protected method [09:30]
AAC so, ++ converts to byte, and then box? [09:31]
AAC so its like classes work (hashcode) i get it.... [09:32]
Maldivia a++; <-- if a is a boxed type, it does: a = (ABox)(APrim)(a.unbox() + (APrim)1); [09:32]
Maldivia AAC: hashCode is just another method, so works like any other method [09:33]
AAC ) [09:33]
ricky_clarkson Byte instead of byte should be very rare. [09:33]
Maldivia but yeah, don't use the boxed types really [09:33]
Maldivia (let's see how much of this flies out the window with inline classes) [09:34]
AAC why is Aprim (second ()) needed? [09:34]
AAC since unbox already gets the primitive valeu [09:35]
AAC hashcode() just flow from class hiearchy :) [09:35]
zalt_ [zalt_!~devp@unaffiliated/lambda443] has joined ##java [09:38]
halprin [halprin!] has joined ##java [09:38]
dansan [dansan!] has joined ##java [09:38]
AAC how can you cast a primitive int, into a Byte? [09:39]
ricky_clarkson via byte [09:41]
Nightwing52 [Nightwing52!~Thunderbi@] has joined ##java [09:41]
AAC ah the second parenthsis [09:41]
AAC ) [09:41]
AAC so it keeps searching for hashcode() until object's hashcode? if its override it will take that? [09:43]
AAC like got a class that override ,and use it [09:43]
AAC it says "default hashcode()" hence my doubts :) [09:44]
AAC probably i can get a class out of it :) [09:44]
AAC can i get a call hiearchy of a method? [09:45]
AAC well ..if a.unbox is zero no need to cast twice :) [09:58]
AAC im not following...if i have Byte b; then System.identityHashCode(), does it calls Byte hashcode? [10:00]
AAC since its overwritten [10:00]
AAC i think that if it doesnt find it, it goes up on class hiearchy [10:01]
AAC but since Byte has it [10:01]
linext [linext!] has joined ##java [10:02]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [10:11]
Xgc [Xgc!~Jon@] has joined ##java [10:12]
AAC since "o.hashCode() == System.identityHashCode(o)" , object have hashcode overwritten (you meantion that in String they werent equal) [10:19]
AAC i think i got the other stuff :) thanks [10:20]
AAC well if its override, doesnt matter if it is or is not..that doesnt make sense [10:32]
dqx [dqx!~dqx@unaffiliated/dqx] has joined ##java [10:33]
fizzie I'll try to rephrase it one more time. If you call o.hashCode(), it will follow the normal method lookup, so look for an implementation in the class, then its superclass, and so on, going all the way up to Object if no other implementation has been found before. If you call System.identityHashCode(o), you will get the implementation that Object has (the "default" one), "whether or not" there is an override [10:47]
fizzie anywhere. [10:47]
AndroidDAW how can i sort an array by superclass? [10:49]
fizzie That's why the first line of of output in is different, but the last two are the same. [10:49]
AAC ah ok thanks got it :) [10:50]
AndroidDAW for example, if i have A, B (extends A), C (extends B) [10:50]
AndroidDAW how would i sort the array such that i always get either A, B, C, or C, B, A [10:50]
AndroidDAW regardless of the actual order [10:50]
AAC great! :D [10:51]
AAC its a bit misleading right ?? the "default" one [10:51]
cheeser not really, no. [10:51]
AAC lol [10:51]
cheeser there's one default one. It's on Object. [10:51]
AAC have you ever came across a defualt thing [10:51]
fizzie AndroidDAW: What would the order you need be if you have A, B (extends A) and C (extends A)? [10:51]
AAC i wonder if you can call it default [10:52]
AndroidDAW well either A, B, C, or A, C, B, or B, C, A, or C, B, A [10:52]
cheeser AAC: of course you can. [10:52]
AAC ) [10:52]
AAC thks for the link [10:52]
AndroidDAW if multiple objects extend the same class, then the order of those objects in relation to eachother does not matter [10:53]
cheeser then write a Comparator that simply counts up until hits Object. that's your sort value. [10:53]
fizzie I think "default" is maybe not the *best* word to use, because "default methods" are a specific (but different) thing, but I imagine that description predates the existence of actual default methods anyway, and that meaning wouldn't apply in the context. [10:53]
AAC yep goes up the object class, hehehhehE :) [10:54]
AndroidDAW (eg it would be exactly the same as, say 1, 2, 2, 3, here, the order of 2, and 2, does not matter so long as 2 comes before 3 and after 1 [10:54]
cheeser fizzie: it's actually the same thing. "if you don't override this method, you get this *default* implementation." [10:54]
AAC well i didnt know this was java jargon :) [10:54]
fizzie Also, just counting the depth from Object doesn't work, for a hierarchy like A, B1 (extends A), C1 (extends B1), B2 (extends A), C2 (extends B2). [10:55]
cheeser why not? [10:55]
AndroidDAW fizzie: yea [10:55]
cheeser should all B1 types come first? [10:56]
fizzie Uh, sorry, it does work in that example, sure. Rethinking. [10:56]
fizzie Okay, fair enough, with single inheritance I guess that's enough. [10:56]
fizzie Man, trees are so simple. [10:56]
cheeser i love trees, too. :) [10:56]
Renari [Renari!] has joined ##java [10:57]
AAC default meaning, if other else fail or doesnt have a value , it will have a value. But could be teorichally everything [10:57]
AAC / [10:57]
fizzie In general what you (seem to) want is a topological sort of the inheritance graph. But since it's a tree, sorting by depth works for that. [10:58]
cheeser fizzie: exactly. unless of course you start weighting trees then you'd want a proper topological sort. [10:58]
cheeser "order by name and inheritance depth" e.g. [10:58]
cheeser or an m-tree [10:59]
AndroidDAW hmm i am not sure i can think of any case where depth sorting would fail [10:59]
cheeser each node is internally sorted by type name and each element has a subtree for its descendants. [11:00]
dqx [dqx!~dqx@unaffiliated/dqx] has joined ##java [11:02]
fizzie AndroidDAW: I mean, it works almost by definition. If your only criteria is that X's superclass sorts before X, well, if you sort by depth, X's superclass has depth that's one less than X, so it comes before X. [11:03]
fizzie (I was just thinking about a general DAG when complaining.) [11:03]
AndroidDAW fizzie: ok :) [11:04]
LionBar [LionBar!~l@gateway/tor-sasl/lionbar] has joined ##java [11:07]
AAC ..can the gc frees object? [11:15]
AAC AAC's title: "headObjects" [11:15]
AAC head=heap [11:15]
cheeser at some point GC might collect that old object. [11:17]
hschmale [hschmale!] has joined ##java [11:20]
_lucifer AAC: don't use `new Integer`. it's a bad practice. the gc may collect a object when it is no longer referenced. say b went out of scope, the gc can collect it. you almost never need to worry about these things though. [11:29]
AAC ) [11:30]
_lucifer write the code as simply as possible. if there's some bottleneck, profile, debug and fix as needed. [11:30]
AAC ok..thanks a lot people :) later [11:36]
mindCrime [mindCrime!] has joined ##java [11:46]
Nightwing52 [Nightwing52!~Thunderbi@] has joined ##java [11:47]