ByteCode.News
Submit RSS Atom Sign in

Back to the channels

#java

  1. taylan Question: If a class A contains code switching over enum E and the values of E are reordered and E recompiled, but A not recompiled, will the switch statement in A still switch over the names of the values, or were the names in the case labels just a stand-in for their ordinal position at the time A was compiled and the cases now apply to different names based on their new ordinal position?
  2. taylan (It was difficult to formulate that question even though it's a simple concept... Not sure I could have formulated it better.)
  3. dreamreal taylan: I think it'll match based on the actual values and not the ordinals. But javap should tell you that pretty clearly.
  4. taylan I'm looking at the bytecode but don't have any experience reading JVM bytecode. Apparently it creates a SwitchMap populated at class init, and I guess that maps the actual enum value objects to integers, so should be fine I guess. It still calls .ordinal() on them which confused me a bit.
  5. taylan https://godbolt.org/z/4qcrWcGnT
  6. nevet Compiler Explorer - Java (jdk 25.0.1)
  7. dreamreal okay, I just ran a test
  8. taylan I'm not sure I understand what 'getstatic #13' and 'getstatic #23' do
  9. dreamreal built two directories, one with enum A, B, C, the other using that in a switch
  10. dreamreal ran the class, got the expected output
  11. dreamreal then I changed the enum to be C, A, B, recompiled it
  12. dreamreal so then I ran the original main() (which was compiled with the other order in the enum) and got the same output
  13. dreamreal so it's working as expected for me, I think
  14. taylan Apparently the operand of getstatic is an index into the runtime constant pool which in turn contains *symbolic* references to fields, and that's how it calls ordinal() on the correct enum objects at init.
  15. taylan thanks for testing btw 🙏
  16. pingveno So, eventually answering my own question... the maven-dependency-plugin's copy-dependencies did the trick for me.
  17. pingveno Now time to get my dependencies upgraded for 2015
  18. pingveno from*
  19. DoofusCanadensis yay!
  20. dreamreal pingveno: so you're using maven?
  21. dreamreal I thought you were using ant and stuff
  22. pingveno dreamreal: I am using ant. This is my pom.xml: https://gist.github.com/adevore/78b33f9ce306d801b267c64335b92bb3
  23. nevet pom.xml for management of a set of jar files
  24. pingveno It won't be run as part of the regular build. Just as part of updating that set of jars. At least for now, I might figure out how to integrate maven into the build system.
  25. dreamreal you're ... using ant... with a pom.xml? Oh, a dual structure. Why not use ivy to do the same thing in ant?
  26. pingveno Oh, I'm just not familiar with ivy.
  27. pingveno And the Ant is maintained upstream, so I'm avoiding modifications as much as possible.
  28. pingveno It's all a bit of a mess :(
  29. Para you can probably use YourFavoriteAI to ask it to give you the Ant script in some Maven executor plugin garble and then ditch the Ant part.
  30. Para (or somesuch, there's several possible options)
  31. dreamreal ~ivy
  32. javabot ivy is a dependency manager for ant (but can run stand-alone). It has transitive dependencies and multiple configurations per module. See http://ant.apache.org/ivy/ to get started
  33. Para Ivy is probably one of my favorite small build tools ever.
  34. pingveno Huh, okay, I'll have to look into it. Thanks for the **ptrs.
  35. dreamreal https://bytecode.news/posts/2026/04/securing-claude-code-guardrails-for-ai-assisted-development-by-jim-manico
  36. jbosmans when choosing between ant and maven I'd at least make choice, and not try to keep/make both working. Do, or do not. There is no try. (except version control rollback i guess) Lame SW ref included for free
  37. dreamreal they may not have a choice to migrate to something sensible, though
  38. jbosmans yeah understand. Old enough to've been there done that, i've had the luck to be able to create deliverables (jar/war/ear files) using maven while rational app dev/arch was the assumed route
  39. jbosmans depending on how long/short of a commitment, i'd always go for maven, and then make ant work again if/when needed
  40. Para There's an Ant executor plugin for Maven, I think. Just to really lay down that concrete.
  41. dreamreal I would push for maven at all possible costs too
  42. jbosmans :D
  43. jbosmans yeah, for me it was always about project/dependency sanity
  44. dreamreal and predictability
  45. jbosmans totally
  46. dreamreal with ant, you can do whatever you want. With maven, the phases are deterministic.
  47. dreamreal "you WILL have this execution. Whether it does what you want... well, you CAN screw that up if you like."
  48. jbosmans yeah and project structure etc
  49. jbosmans modules
  50. Para Back in school I did get some extra credit for using Ant to create a simple JSP website which also contained a link to a download which had the whole project embedded as ZIP because we were supposed to return it as part of the assignment.
  51. jbosmans Para, ~which year?
  52. Para 2006 or -07, I think.
  53. jbosmans i remember hearing a teacher saying "you can use spring but that's too hard"
  54. jbosmans hah yeah
  55. jbosmans JSP was the name of the game back then
  56. dreamreal spring's too hard compared to WHAT
  57. Para I think that was also my first case of somewhat malicious compliance.
  58. dreamreal OMG, do people just not remember j2ee?
  59. Para The intent was to 1) deploy the website to school's server and 2) copy the file to shared disk :P
  60. dreamreal "look, all you have to do is run ejbc, then put on a deployer hat and figure out your specific app server's JNDI configuration, then deploy and set up resources that JNDI points to..."
  61. Para I remember being absurdly lost when I saw uhhh what was it even called the first time, the whole j2ee service thing.
  62. jbosmans yeah it was all part of the times, and i didn't know better
  63. jbosmans JNDI :')
  64. jbosmans "magically just works"
  65. dreamreal I had no problems with JNDI BUT expecting every developer to understand all the roles was dumb
  66. dreamreal especially when it was obvious they didn't
  67. jbosmans yeah, it really was early days in ways
  68. Para I have to take a moment to jog the poor ol' brain cell, I want to see if I arrive at the right name on my own :)
  69. jbosmans EJB?
  70. Para EJB local/remote thing
  71. dreamreal remote and local interfaces. And those were LATE EJB.
  72. dreamreal and even those were a sop to IBM and BEA for being incompetent at server design.
  73. jbosmans those were the days
  74. Para Back when engineers had to engineer!
  75. jbosmans one eyed king in the land of the blind
  76. dreamreal I have both pity and understanding but no forgiveness
  77. jbosmans btw <dreamreal> spring's too hard compared to WHAT -> plain servlet + jsp iirc
  78. jbosmans "just the servlet container"
  79. dreamreal jbosmans: so, uh, how does the servlet get JDBC connections? What about looking up other services?
  80. jbosmans datasources work iirc ?
  81. jbosmans my teacher said that right? not me
  82. jbosmans it was real early days for spring
  83. dreamreal JNDI data sources?
  84. dreamreal I mean, JNDI is how the app is SUPPOSED to get things from the container
  85. jbosmans and i figure he couldn't tackle spring himself those days
  86. jbosmans iirc datasources can work in a servlet container context "iirc"
  87. dreamreal jbosmans: so they manage the drivers themselves?
  88. dreamreal there's no "IIRC" here, I know the answers.
  89. dreamreal I don't know what your teachers were saying, of course, but I was there myself.
  90. jbosmans iirc the servlet container yes ?
  91. dreamreal jbosmans: no, the war
  92. jbosmans given right declarations in servlet.xml or whatever
  93. jbosmans it's been too long :)
  94. dreamreal did you deploy a driver in the .war? Or did you get the connection from JNDI?
  95. jbosmans i "think" latter
  96. jbosmans but it was tomcat for sure
  97. jbosmans early days tomcat
  98. Para Well, jogged Claude to get a simple example of that local/remote interface and fuck, no wonder I was confused as a youngling.
  99. jbosmans mm maybe it wasn't tomcat
  100. dreamreal sure. Getting the connection from JNDI: did you set to the tomcat JNDI connection or access the JDBC connection directly? (java:comp/env/jdbc/foo, or "java:/foo"?)
  101. dreamreal tomcat had a JNDI container, because it had to
  102. dreamreal like I said, I was there, I remember
  103. dreamreal I don't know what YOU did but I know what you SHOULD have done and I know what most people ACTUALLY DID and they were not the same things
  104. Para It was also fun to deploy on customer's Tomcat.
  105. jbosmans i only remember the early servlet + jsp days where i had a teacher who said spring's too complicated
  106. Para "Yeah so we have these JARs shared by all apps so make sure they don't conflict"
  107. dreamreal think your teacher was a fool
  108. jbosmans it was about passing
  109. jbosmans he was okay, i learned a lot
  110. dreamreal sure
  111. jbosmans he wasn't all knowing obv
  112. Para (that's actually part of the reason why we found Ivy so convenient back then, one could make a negation profile of these deployment targets easily and basically tell to compile with all, package with those excluded)
  113. jbosmans iirc spring used ivy for a while
  114. Para I want to claim a false memory of Ivy stabilizing the idea of provided scope.
  115. jbosmans could very well be, i couldn't comment
  116. jbosmans jakarta EE still going strong seems like
  117. jbosmans afaik a different kind of spring where capabilities are delegated to the runtime
  118. jbosmans number of compliant runtimes seem to be slowly decreasing
  119. jbosmans alas i still have a bunch of velocity templates for one project, may intellij's support never go away
  120. Para I wish the startup I worked for somehow would've been able to give us the source codes of things before it went totally bust.
  121. Para We did fun things for Velocity, for example slurp XML and manipulate it with Velocity as if it was actually easy to work data structure :)
  122. jbosmans haha yeah
  123. jbosmans it all pivoted more and more towards best IDE support for me
  124. jbosmans thymeleaf is pretty nice, but it'd probably still be velocity (or something extremely dumb & low tech) if the IDE support wasn't up to par
  125. jbosmans i recently did get the thymeleaf layout dialect out of all projects that used it
  126. jbosmans no more groovy runtime ^
  127. dreamreal jakarta EE is never going to go away
  128. dreamreal spring never tried to get rid of j2ee/javaee/jakarta ee
  129. jbosmans i think that'd be good if it never went away
  130. jbosmans yeah i know
  131. dreamreal just made the low hanging fruit *truly* low hanging fruit and made testing much more easy like it always should have been
  132. jbosmans it's a nice back and forth between jakarta EE and other frameworks, a symbiosis
  133. dreamreal I guess. It's really more that most developers didn't need j2ee, didn't want j2ee, just had no other tools to work with, so when all they had was a hammer, everything looked like a nail
  134. jbosmans yeah i see what you mean && can sympathize
  135. dreamreal srticle Spring and J2EE
  136. dreamreal logs 75m
  137. dreamreal includeai
  138. dreamreal done
  139. dreamreal dang it, I wish I felt good unmuting nevet in here
  140. dreamreal it's just that javabot's sort of the channel pet project, and nevet and javabot would overlap
  141. jbosmans i'd clear that out
  142. jbosmans and set goals, last of which for MVP == unmuted
  143. jbosmans afterwards, it's just a matter of ticking boxes
  144. * jbosmans && full blown getting things done mode in ways
  145. dreamreal what do you mean?
  146. dreamreal I don't have a goal of deprecating javabot
  147. dreamreal javabot's used as a dev platform for a lot of useful projects
  148. javabot dreamreal, what does that even *mean*?
  149. jbosmans it's not about javabot, it's about nevet, you want to unmute it?
  150. jbosmans so what's needed to get that done etc
  151. jbosmans "it can't conflict with javabot" "so make sure it doesn't" etc
  152. dreamreal For nevet to be unmuted HERE it'd have to be replacing javabot, as some of their feature sets overlap
  153. jbosmans setting goals && ticking boxes
  154. dreamreal and I do not have a goal of unmuting nevet here
  155. jbosmans <dreamreal> dang it, I wish I felt good unmuting nevet in here
  156. jbosmans i misunderstood you
  157. jbosmans s/you/what you meant
  158. dreamreal I can see value in it being unmuted without a specific goal of unmuting it
  159. dreamreal it would be trivial to actually unmute it, it's a flag in the system
  160. jbosmans yeah i understand irc
  161. dreamreal "don't mute irc for channel #java on libera"
  162. dreamreal and it's not muted on the server level, it's a flag inside nevet itself
  163. dreamreal and it's specifically a flag on THIS channel
  164. jbosmans right, understand, many roads to rome
  165. jbosmans if commands/triggers don't conflict ..
  166. dreamreal because I didn't want nevet's url title operation clashing with javabot's, or karma, or factoids, or anything else
  167. dreamreal well, there are things that are not triggered specifically
  168. dreamreal like url titles, etc
  169. dreamreal they're both infobots: you really don't want multiple infobots in a single channel. So nevet watches for information it can use (karma, channel logs) and has a flag to never emit content here
  170. jbosmans yeah i understand
  171. dreamreal I can set factoids in nevet here, but it won't emit them here
  172. dreamreal and I don't see it as a competition, because nevet's not "a better javabot," it's a different infobot
  173. jbosmans just wanted to say, depending on what you want i'd guess you can make it happen :)
  174. dreamreal I could make it happen pretty easily, although I'd want cheeser's permission in any event
  175. dreamreal (it'd be a one-line command to nevet, actually)
  176. jbosmans so there's a checkbox right there :)
  177. jbosmans "an actionable action" (iirc)
  178. dreamreal 69
  179. nevet 69 is the Java classfile format number for Java 25. Nice! ... and being the product of two primes is neat, too.
  180. dreamreal see?
  181. Para 67
  182. nevet 67 is the Java classfile format number for Java 23.
  183. Para aww
  184. dreamreal I turned it back off :D
  185. dreamreal Like I said, it's a competiton between infobots where I choose specifically to have nevet lose
  186. jbosmans i just meant identify the hills to climb, and climb them
  187. jbosmans nah
  188. dreamreal jbosmans: in general, already done
  189. Para ~nevet++
  190. nevet ~nevet now has karma of 1.
  191. javabot nevet has a karma level of 1, Para
  192. jbosmans choose a different trigger char or whatever
  193. dreamreal jbosmans: sure, again, already done
  194. dreamreal see the ! as opposed to javabot's ~ (and you can set that per network/medium, too)
  195. jbosmans from my end, these are trivial challenges given (i'm guessing) all the work that went into nevet
  196. dreamreal but then you run into url titles
  197. jbosmans so disable that
  198. jbosmans and provide a custom trigger for nevet
  199. dreamreal disable... the triggerless options?
  200. jbosmans url www.google.com
  201. jbosmans whatever
  202. dreamreal ew
  203. jbosmans well if nothing is better .. :)
  204. dreamreal So there's this project, https://telaproject.org/ and it's very cool
  205. nevet Tela
  206. javabot dreamreal's title: "Tela: encrypted remote access from a single binary"
  207. dreamreal hrmm. Wonder what happened THERE?
  208. dreamreal oh, I know
  209. dreamreal But anyway, THAT's the problem: the utilities between nevet and javabot clash in a lot of ways, and disabling the utilities on a provenance level gets expensive and kinda painful
  210. dreamreal generally not worth it
  211. jbosmans well, you know best in any case
  212. jbosmans i was just trying to point out a complementary approach instead of exclusive
  213. dreamreal I dunno about "best" but I had to make choices and made them the best I could
  214. jbosmans frankly i'd settle for ! or !! or $ or $$ or ... to trigger
  215. jbosmans if you don't expose functionality, nobody will ever use it, you solved that yourself
  216. dreamreal nevet uses !, javabot uses ~, but there are triggerless functions
  217. jbosmans yeah i understand, so start of with disabling the triggerless functions instead of disabling everything?
  218. jbosmans anyhow, just a suggestion
  219. dreamreal Yeah, that's definitely an option, but having a breaker based on *provenances* is something I'm trying to resist, since it's limited so much to specific channels like this one
  220. dreamreal Oh, I didn't type "!article" - I typoed it!
  221. dreamreal No wonder!
  222. dreamreal article Spring vs J2EE: not a competition
  223. nevet Idea session started: "Spring vs J2EE: not a competition". Use 'content <text>' to add body paragraphs, 'includeai' to enable AI summary/tags, 'done' to save, or 'cancel' to discard.
  224. dreamreal logs 90m
  225. nevet Added 100 log messages (last 1h) as content block #1.
  226. dreamreal includeai
  227. nevet AI summary enabled for "Spring vs J2EE: not a competition". On 'done', a generated summary and suggested tags will be appended to the draft.
  228. dreamreal done
  229. nevet Idea saved as draft: "Spring vs J2EE: not a competition" (1 content block). AI summary appended for admin review.
  230. dreamreal since nevet was muted, I figured its silence was a natural outcome :D
  231. dreamreal I figured something was up to swallow the output on the server, turns out I never gave it the START trigger
  232. jbosmans yeah, typo'd the trigger :)
  233. dreamreal I just got back from the eye doctor, getting a new prescription, primarily for my work computers :/
  234. jbosmans :/ i can relate
  235. jbosmans can't read properly late in the evening
  236. dreamreal huh, that actually worked out pretty well
  237. jbosmans for me it's fatigue
  238. jbosmans i'm hoping !
  239. dreamreal It included the entire log, so it noted that there were ancillary topics (velocity, ivy, thymeleaf) but actually got the core of the concept down pretty well as a draft summary
  240. dreamreal (and has a note: "this is not publishable: please edit into shape")
  241. jbosmans nice, llm's being leveraged :)
  242. jbosmans one doesn't belong tho: velocity, ivy, thymeleaf
  243. dreamreal well, the "!includeai" is releant there
  244. jbosmans or another is missing
  245. dreamreal oh, none of them belong, but the "!logs" goes back and includes ALL OF THE LOGS
  246. dreamreal so ifthere're more than one thing being discussed, it's including them all
  247. jbosmans yeah makes sense
  248. jbosmans it's often mostly about input
  249. dreamreal yeah, the whole goal of nevet was to make discovery easy, and that means trimming things out
  250. dreamreal BTW, *everyone*, I'd appreciate it greatly IF you think bytecode.news is worth reading and IF you'd then propagate the URL about as much as you're willing to. If you don't think it's worth reading, acknowledged (what would change that?) and if you think it's not worth sharing, I understand that too (and what would change THAT?) But if you think it's good and worth sharing... do a brother a solid,
  251. dreamreal would you?
  252. dreamreal the site's not monetized and I have no plans to monetize it yet - the backend server is the valuable tech, to me. (content's too easy to fake and find, anyway.) but I'd still like it to be read.
  253. dreamreal If I could FIND a way to monetize the site after it has decent readership that it deserves, I'm willing to consider it, but... right now, no plans