Timeline for Print X without X (cop's thread)
Current License: CC BY-SA 4.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 28, 2020 at 0:09 | comment | added | MCross | That's exactly what I had, just using an anonymous inner class instead of the enclosing class. | |
| Jul 27, 2020 at 23:14 | comment | added | nthistle | Here's a similar crack that doesn't use AutoCloseable, possibly closer to the original solution(?). | |
| Jul 27, 2020 at 22:50 | comment | added | nthistle | Yeah, the reflection ended up being a non-starter. The originally idea was basically to use method references (which you only need :: to get) to something like System.err::write and then find a way to invoke them, but invoking method references in Java basically requires ., unless I could find something in the standard library that would invoke it for me (unlikely). Likewise, you can't really use reflection to even access the err attribute of System without using a . somewhere. | |
| Jul 27, 2020 at 21:53 | comment | added | user | Not sure you can use reflection for this - I just spent half the day trying to do it, but you have to use dots in Java to do anything more than this | |
| Jul 27, 2020 at 21:51 | comment | added | MCross | @user Same trick I used, just in a different format; I just made my main class extend Exception, allowing me to invoke printStackTrace without a dot from its constructor. I guess I could have just reposted again blocking colons (to prevent creating an Autocloseable from a Throwable), but I think twice is enough for one solution, especially when you're that close. Good work! ...still would be interested in seeing the Reflection that nthistle was planning, though... | |
| Jul 27, 2020 at 21:39 | history | edited | MCross | CC BY-SA 4.0 | added 124 characters in body |
| Jul 27, 2020 at 19:35 | comment | added | user | Cracked. @nthistle, you really helped me! | |
| Jul 27, 2020 at 3:10 | comment | added | nthistle | While I was doing research for this, I stumbled upon this, which is basically almost identical -- since I'm assuming this isn't intended either, I'm going to some time looking for something better (I'm kinda close on a reflection approach). | |
| Jul 27, 2020 at 2:30 | history | answered | MCross | CC BY-SA 4.0 |