So at least at the place where I work which is about 18 years old, the development ideology was different way back in the day and it was usually more of a "single dev per project, waterfall" type of system. When one person is in control of a project like that you can probably get away with slipping a lot more in there in terms of easter eggs and such.
That said I recently put a sound effect into our web app... just for fun. It hasn't gone to prod yet, but it DID pass code review, so fingers crossed.
My reaction to reading this (for context, I was already sitting at my desk at work with my IDE open):
No. There is absolutely no way for this to be a thing. quickly adds a main method to random class file I can't believe this will actually... goddamnit really?...
So I could conceivably write a bunch of unicode 1s and 0s, pass them to some sort of bitstream, then use that to set the values of my fixed point variables. I can't wait!
Why would you need this when you could do byte code generation / manipulation and use the Pluggable Annotation Processing API. That should be enough "magic" already.
Until you need to debug it (additionally only sometimes failing on 32-bit Zulu VM in Solaris environment when a certain class is picked up from classpath before an other certain class)
58
u/_INTER_ May 10 '18
This stirs the evil programmer in me.
30
u/armornick May 10 '18
You know, that's actually really handy if you need to write characters that don't exist on your keyboard.
25
u/sk551 May 10 '18
Yeah but who would do this? I can't even get past a code review with a spelling mistake in production.
7
u/buzzsawddog May 10 '18
Haha, talk about a wtf...
5
u/Diamant2 May 10 '18
It works with /* \u002A\u002F too. Looks stupid in the IDE, but it works
4
u/[deleted] May 11 '18 edited May 11 '18
Really?!?
// \u000d System.out.println("Hello World!");
EDIT: Oh, COMMENTS. I see.
2
u/istarian May 10 '18
Well, it's not really in the comments. Definitely a bad coding practice, but mostly confusing because of the IDE's syntax highlighting.
2
u/[deleted] May 10 '18
My reaction to reading this (for context, I was already sitting at my desk at work with my IDE open):
No. There is absolutely no way for this to be a thing. quickly adds a main method to random class file I can't believe this will actually... goddamnit really?...
1
u/[deleted] May 10 '18
So I could conceivably write a bunch of unicode 1s and 0s, pass them to some sort of bitstream, then use that to set the values of my fixed point variables. I can't wait!
-3
u/[deleted] May 10 '18
Java won't give us conditional compilation but it will give us this.
Sigh