public static void addDialyzerWarningMarkersFromResultList( final IErlProject project, final Backend backend, final OtpErlangList result) { if (result == null) { return; } final IProject p = project.getProject(); for (final OtpErlangObject i : result) { final OtpErlangTuple t = (OtpErlangTuple) i; final OtpErlangTuple fileLine = (OtpErlangTuple) t.elementAt(1); final String filename = Util.stringValue(fileLine.elementAt(0)); final OtpErlangLong lineL = (OtpErlangLong) fileLine.elementAt(1); int line = 1; try { line = lineL.intValue(); } catch (final OtpErlangRangeException e) { ErlLogger.error(e); } String s = ErlideDialyze.formatWarning(backend, t).trim(); final int j = s.indexOf(": "); if (j != -1) { s = s.substring(j + 1); } addDialyzerWarningMarker(p, filename, line, s); } }
/** * Returns the Java long value of the wrapped erlang value. * * @return the converted value * @throws ClassCastException if thrown if a conversion is not possible, i.e. the type is not * supported or the value is too big */ public long longValue() throws ClassCastException { final OtpErlangLong longValue = (OtpErlangLong) value; if (longValue.isLong()) { return longValue.longValue(); } else { throw new ClassCastException( "Cannot cast to long - value is too big (use bigIntValue() instead)."); } }
public List<IStackFrame> getStackFrames(final IDebugTarget target, final IThread process) { // XXX JC copy paste final OtpErlangTuple tuple = getTuple(); final OtpErlangList erlStackFrames = (OtpErlangList) tuple.elementAt(2); final OtpErlangTuple t2 = (OtpErlangTuple) tuple.elementAt(1); final OtpErlangTuple ieval = (OtpErlangTuple) t2.elementAt(0); OtpErlangAtom m = (OtpErlangAtom) ieval.elementAt(3); OtpErlangList bindings = (OtpErlangList) t2.elementAt(t2.arity() - 1); OtpErlangLong l = (OtpErlangLong) ieval.elementAt(1); final List<IStackFrame> stackFrames = new ArrayList<IStackFrame>(erlStackFrames.arity() + 1); for (final OtpErlangObject o : erlStackFrames) { final OtpErlangTuple t = (OtpErlangTuple) o; final OtpErlangTuple ml = (OtpErlangTuple) t.elementAt(1); final OtpErlangObject ml0 = ml.elementAt(0); int stackFrameNo; final OtpErlangLong n = (OtpErlangLong) t.elementAt(3); try { stackFrameNo = n.intValue(); } catch (final OtpErlangRangeException e) { stackFrameNo = -1; } final String module = m.atomValue(); int line; try { line = l.intValue(); } catch (final OtpErlangRangeException e) { line = -1; } final IStackFrame sf = new ErlangStackFrame( module, (ErlangProcess) process, target, line, null, bindings, stackFrameNo); stackFrames.add(sf); bindings = (OtpErlangList) t.elementAt(2); m = (OtpErlangAtom) ml0; l = (OtpErlangLong) ml.elementAt(1); } return stackFrames; }