From: Jeff A. <ja...@fa...> - 2018-04-15 17:06:14
|
In small steps on this, I have refactored PyJavaType.init from its original 560 lines to nearer 250 and a dozen helpers, with no change in meaning at this point. In the past, I have had to step through this code a lot and invariably I've lost my way. As I'll be doing more of that now, this ought to help. I can't say I understand everything it does yet (which makes sensible decisions more difficult). There is some helpful stuff around Java accessibility that I think I can adapt. Jeff Jeff Allen On 05/04/2018 21:28, Jeff Allen wrote: > Java 9 is throwing us an interesting problem. This will be an issue > wherever the factory pattern is used, and the actual class of object > handed out may be a private implementation class not exported to the > unnamed module. It's a common pattern. > > In Java, the compile-time type of the object is the public type the > factory method returns. The implementation type extends or implements > that "API" type, and it is the public methods of the API type that the > compiled code references. In Jython, we end up trying to reference the > implementation mthods directly. Java 9 forbids this, or at least > grumbles about it unattractively. > > I have an idea to resolve it, but it alters the Python type of a Java > class. Could be good or bad. What do others think? > > More in the text of the issue. http://bugs.jython.org/issue2662 > |