private void setPreferredClassType(LineBreakpoint lb, JPDAClassType classType) { try { Method setPreferredClassTypeMethod = lb.getClass().getMethod("setPreferredClassType", JPDAClassType.class); setPreferredClassTypeMethod.setAccessible(true); setPreferredClassTypeMethod.invoke(lb, classType); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { Exceptions.printStackTrace(ex); lb.setPreferredClassName(source.getClassType().getName()); } }
public String getURL(JPDAClassType clazz, String stratum) { if (!(stratum == null || JSUtils.JS_STRATUM.equals(stratum)) || !clazz.getName().startsWith(JSUtils.NASHORN_SCRIPT)) { return null; } Source source = Source.getSource(clazz); if (source == null) { return null; } URL url = source.getRuntimeURL(); if (url == null) { url = source.getUrl(); } if (url != null) { return url.toExternalForm(); } else { return null; } }
this.classType = classType; if (LOG.isLoggable(Level.FINE)) { LOG.fine("new Source("+name+", "+classType.getName()+", "+url+")");
private void scriptToBeInvoked(ObjectVariable mh) { ObjectVariable member = (ObjectVariable) mh.getField("member"); if (!(member instanceof ObjectVariable)) { logger.info("Variable "+mh+" does not have member field: "+member); return ; } ObjectVariable clazz = (ObjectVariable) member.getField("clazz"); if (!(clazz instanceof ClassVariable)) { logger.info("Variable "+mh+" does not have clazz field: "+clazz); return ; } //JPDAClassType classType = ((ClassVariable) clazz).getReflectedType(); JPDAClassType classType; try { classType = (JPDAClassType) clazz.getClass().getMethod("getReflectedType").invoke(clazz); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException ex) { Exceptions.printStackTrace(ex); return ; } String className = classType.getName(); MethodBreakpoint mb = MethodBreakpoint.create(className, ""); mb.setHidden(true); mb.setSuspend(debugger.getSuspend()); mb.setSession(debugger); mb.addJPDABreakpointListener(new InScriptBPListener(mb)); DebuggerManager.getDebuggerManager().addBreakpoint(mb); logger.log(Level.FINE, "Created {0} for any method in {1}", new Object[]{mb, className}); }
private LineBreakpoint createLineBreakpoint() { int lineNo = jslb.getLineNumber(); lineNo += source.getContentLineShift(); LineBreakpoint lb = LineBreakpoint.create("", lineNo); lb.setHidden(true); //lb.setPreferredClassType(source.getClassType()); setPreferredClassType(lb, source.getClassType()); if (LOG.isLoggable(Level.FINE)) { LOG.fine("LineBreakpointHandler.createLineBreakpoint() classtype = "+source.getClassType().getName()); } lb.setSuspend(JPDABreakpoint.SUSPEND_EVENT_THREAD); lb.setSession(debugger); if (!jslb.isEnabled()) { lb.disable(); } return lb; }
MethodBreakpoint scriptMethodBP = MethodBreakpoint.create(scriptType.getName(), "*getMap"); scriptMethodBP.setHidden(true); scriptMethodBP.setSuspend(EventRequest.SUSPEND_EVENT_THREAD);
superTypeNames.add(intrfc.getName());