I tried to obfuscate my Java code before sending it to AI — here's what broke A developer spent over a month trying to obfuscate Java source code before sending it to AI assistants, only to discover that Spring Data's repository method names and @Query annotations are semantically significant and cannot be renamed without breaking the application. The project required preserving Spring Data method naming conventions and JPQL queries, turning a simple string-replace task into a framework-aware obfuscation problem. When a client added a "no AI assistants on our codebase" clause to my contract last year, I did what any developer would do: I assumed I could solve it with regex. The plan was simple. Before sending Java source to Claude, I'd rename every identifier — InvoiceService becomes Cls a1b2c3d4 , customerName becomes fld e5f6a7b8 . The AI works on the obfuscated version, I rename everything back, the AI never sees my actual domain. Five hundred lines of code, two days max. I was sure of it. It took two weeks before I had something that even compiled, and another month before the tests passed. This article is a tour of the things that broke and why each one is a different shape of the same lesson: Java code obfuscation for AI is a framework problem, not a string-replace problem. If you've never tried this, the obvious approach feels obvious for a reason. You parse the Java file, collect the identifiers classes, methods, fields, packages , generate a deterministic hash for each one, replace every occurrence. Roughly: // Before public class InvoiceService { public Invoice calculateDiscount Invoice invoice { return invoice.applyDiscount 0.10 ; } } // After public class Cls a1b2c3d4 { public Cls e5f6a7b8 mtd 9c8d7e6f Cls e5f6a7b8 fld 3a4b5c6d { return fld 3a4b5c6d.mtd 2c1b0a9f 0.10 ; } } Fine, right? The AI sees something structurally identical — same control flow, same types, same method calls — but with no business meaning to leak. JavaParser handles the AST, you walk it once, you're done. You're not done. This works on a hello-world program. The first time you run it on a real Spring Boot project, your application context fails to start. And the failure has nothing to do with the AI yet — it's the framework loudly telling you that the names you renamed meant something to it . This was my first proper "oh." moment. Consider: public interface InvoiceRepository extends JpaRepository