63 super(methodSignature, primID, srctype, comptype, dsttype); 64 this.owner = owner; 65 this.relativeClassName = relativeClassName; 66 } 67 68 public GraphicsPrimitive makePrimitive(SurfaceType srctype, 69 CompositeType comptype, 70 SurfaceType dsttype) { 71 // This should never happen. 72 throw new InternalError("makePrimitive called on a Proxy!"); 73 } 74 75 // 76 // Come up with the real instance. Called from 77 // GraphicsPrimitiveMgr.locate() 78 // 79 GraphicsPrimitive instantiate() { 80 String name = getPackageName(owner.getName()) + "." 81 + relativeClassName; 82 try { 83 Class<?> clazz = Class.forName(name); 84 GraphicsPrimitive p = (GraphicsPrimitive) clazz.newInstance(); 85 if (!satisfiesSameAs(p)) { 86 throw new RuntimeException("Primitive " + p 87 + " incompatible with proxy for " 88 + name); 89 } 90 return p; 91 } catch (ClassNotFoundException ex) { 92 throw new RuntimeException(ex.toString()); 93 } catch (InstantiationException ex) { 94 throw new RuntimeException(ex.toString()); 95 } catch (IllegalAccessException ex) { 96 throw new RuntimeException(ex.toString()); 97 } 98 // A RuntimeException should never happen in a deployed JDK, because 99 // the regression test GraphicsPrimitiveProxyTest will catch any 100 // of these errors. 101 } 102 103 private static String getPackageName(String className) { 104 int lastDotIdx = className.lastIndexOf('.'); | 63 super(methodSignature, primID, srctype, comptype, dsttype); 64 this.owner = owner; 65 this.relativeClassName = relativeClassName; 66 } 67 68 public GraphicsPrimitive makePrimitive(SurfaceType srctype, 69 CompositeType comptype, 70 SurfaceType dsttype) { 71 // This should never happen. 72 throw new InternalError("makePrimitive called on a Proxy!"); 73 } 74 75 // 76 // Come up with the real instance. Called from 77 // GraphicsPrimitiveMgr.locate() 78 // 79 GraphicsPrimitive instantiate() { 80 String name = getPackageName(owner.getName()) + "." 81 + relativeClassName; 82 try { 83 @SuppressWarnings("deprecation") 84 Object object = Class.forName(name).newInstance(); 85 GraphicsPrimitive p = (GraphicsPrimitive) object; 86 if (!satisfiesSameAs(p)) { 87 throw new RuntimeException("Primitive " + p 88 + " incompatible with proxy for " 89 + name); 90 } 91 return p; 92 } catch (ClassNotFoundException ex) { 93 throw new RuntimeException(ex.toString()); 94 } catch (InstantiationException ex) { 95 throw new RuntimeException(ex.toString()); 96 } catch (IllegalAccessException ex) { 97 throw new RuntimeException(ex.toString()); 98 } 99 // A RuntimeException should never happen in a deployed JDK, because 100 // the regression test GraphicsPrimitiveProxyTest will catch any 101 // of these errors. 102 } 103 104 private static String getPackageName(String className) { 105 int lastDotIdx = className.lastIndexOf('.'); |