137 new Class<?>[] { providerType }, ih);
138 }});
139 }
140
141 /**
142 * Triggers a framework probe when a user interface method is called.
143 *
144 * This method dispatches a user interface method call to the appropriate
145 * probe associated with this framework.
146 *
147 * If the invoked method is not a user-defined member of the interface,
148 * then it is a member of {@code Provider} or {@code Object} and we
149 * invoke the method directly.
150 *
151 * @param proxy the instance whose method was invoked
152 * @param method the method that was called
153 * @param args the arguments passed in the call.
154 * @return always null, if the method is a user-defined probe
155 */
156 public Object invoke(Object proxy, Method method, Object[] args) {
157 Class declaringClass = method.getDeclaringClass();
158 // not a provider subtype's own method
159 if (declaringClass != providerType) {
160 try {
161 // delegate only to methods declared by
162 // com.sun.tracing.Provider or java.lang.Object
163 if (declaringClass == Provider.class ||
164 declaringClass == Object.class) {
165 return method.invoke(this, args);
166 } else {
167 // assert false : "this should never happen"
168 // reaching here would indicate a breach
169 // in security in the higher layers
170 throw new SecurityException();
171 }
172 } catch (IllegalAccessException e) {
173 assert false;
174 } catch (InvocationTargetException e) {
175 assert false;
176 }
177 } else {
|
137 new Class<?>[] { providerType }, ih);
138 }});
139 }
140
141 /**
142 * Triggers a framework probe when a user interface method is called.
143 *
144 * This method dispatches a user interface method call to the appropriate
145 * probe associated with this framework.
146 *
147 * If the invoked method is not a user-defined member of the interface,
148 * then it is a member of {@code Provider} or {@code Object} and we
149 * invoke the method directly.
150 *
151 * @param proxy the instance whose method was invoked
152 * @param method the method that was called
153 * @param args the arguments passed in the call.
154 * @return always null, if the method is a user-defined probe
155 */
156 public Object invoke(Object proxy, Method method, Object[] args) {
157 Class<?> declaringClass = method.getDeclaringClass();
158 // not a provider subtype's own method
159 if (declaringClass != providerType) {
160 try {
161 // delegate only to methods declared by
162 // com.sun.tracing.Provider or java.lang.Object
163 if (declaringClass == Provider.class ||
164 declaringClass == Object.class) {
165 return method.invoke(this, args);
166 } else {
167 // assert false : "this should never happen"
168 // reaching here would indicate a breach
169 // in security in the higher layers
170 throw new SecurityException();
171 }
172 } catch (IllegalAccessException e) {
173 assert false;
174 } catch (InvocationTargetException e) {
175 assert false;
176 }
177 } else {
|