equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
91 try { |
91 try { |
92 if (name != null) { |
92 if (name != null) { |
93 type = ClassFinder.findClass(name, type.getClassLoader()); |
93 type = ClassFinder.findClass(name, type.getClassLoader()); |
94 } |
94 } |
95 if (this.type.isAssignableFrom(type)) { |
95 if (this.type.isAssignableFrom(type)) { |
96 return (T) type.newInstance(); |
96 @SuppressWarnings("unchecked") |
|
97 T tmp = (T) type.newInstance(); |
|
98 return tmp; |
97 } |
99 } |
98 } |
100 } |
99 catch (Exception exception) { |
101 catch (Exception exception) { |
100 // ignore any exceptions |
102 // ignore any exceptions |
101 } |
103 } |