diff --git a/bin/org/ntlab/traceDebugger/DebuggingController.class b/bin/org/ntlab/traceDebugger/DebuggingController.class index 5685d92..fd30e35 100644 --- a/bin/org/ntlab/traceDebugger/DebuggingController.class +++ b/bin/org/ntlab/traceDebugger/DebuggingController.class Binary files differ diff --git a/src/org/ntlab/traceDebugger/DebuggingController.java b/src/org/ntlab/traceDebugger/DebuggingController.java index 6bde82c..d781ec5 100644 --- a/src/org/ntlab/traceDebugger/DebuggingController.java +++ b/src/org/ntlab/traceDebugger/DebuggingController.java @@ -51,8 +51,8 @@ // InputDialog inputDialog = new InputDialog(null, "method signature dialog", "Input method signature", "void Company.pay(Money,Person)", null); // InputDialog inputDialog = new InputDialog(null, "method signature dialog", "Input method signature", "void worstCase.P.setM(worstCase.M)", null); // InputDialog inputDialog = new InputDialog(null, "method signature dialog", "Input method signature", "public void org.jhotdraw.draw.DefaultDrawingView.addToSelection(org.jhotdraw.draw.Figure)", null); -// InputDialog inputDialog = new InputDialog(null, "method signature dialog", "Input method signature", "void E.setC(C)", null); - InputDialog inputDialog = new InputDialog(null, "method signature dialog", "Input method signature", "void _arraySample.D.setC(_arraySample.C)", null); + InputDialog inputDialog = new InputDialog(null, "method signature dialog", "Input method signature", "void E.setC(C)", null); +// InputDialog inputDialog = new InputDialog(null, "method signature dialog", "Input method signature", "void _arraySample.D.setC(_arraySample.C)", null); if (inputDialog.open() != InputDialog.OK) return false; String methodSignature = inputDialog.getValue(); inputDialog = new InputDialog(null, "line No dialog", "Input line no", "", null); diff --git a/src/org/ntlab/traceDebugger/analyzerProvider/DeltaMarkerManager.java b/src/org/ntlab/traceDebugger/analyzerProvider/DeltaMarkerManager.java index 2d893a8..dd98e05 100644 --- a/src/org/ntlab/traceDebugger/analyzerProvider/DeltaMarkerManager.java +++ b/src/org/ntlab/traceDebugger/analyzerProvider/DeltaMarkerManager.java @@ -134,14 +134,16 @@ if (attributes.containsKey(IMarker.LINE_NUMBER)) return false; if (node instanceof org.eclipse.jdt.core.dom.MethodDeclaration) { try { + // note: �Y�����郁�\�b�h�Ăяo���̏ꍇ�̂ݎq�m�[�h�̒T���𑱍s String src1 = node.toString().replaceAll(" ", ""); src1 = src1.substring(0, src1.lastIndexOf("\n")); - String src2 = method.getSource().replaceAll(" |\t|\r", ""); - return (src1.equals(src2)); + String src1Head = src1.substring(0, src1.indexOf(")") + 1); + String src2 = method.getSource().replaceAll(" |\t|\r", ""); + return src2.contains(src1Head); } catch (JavaModelException e) { e.printStackTrace(); return false; - } + } } return true; } @@ -213,7 +215,7 @@ // note: ���\�b�h�Ăяo���̃��V�[�o���t�B�[���h�̏ꍇ�̓t�B�[���h�A�N�Z�X�̃m�[�h���Ɨ��Ȃ�������ɂ���Œʂ� int lineNo = cUnit.getLineNumber(node.getStartPosition()); if (lineNo != alias.getLineNo()) return true; - if (!(node.getParent() instanceof org.eclipse.jdt.core.dom.MethodInvocation)) return true; + if (!(node.getParent() instanceof org.eclipse.jdt.core.dom.MethodInvocation)) return true; String name1 = node.toString(); String name2 = fa.getFieldName(); name2 = name2.substring(name2.lastIndexOf(".") + 1); @@ -240,6 +242,47 @@ } attributes.put(IMarker.LINE_NUMBER, lineNo); return false; + } + }; + } else if (statement instanceof MethodInvocation) { + final MethodInvocation mi = (MethodInvocation)statement; + final MethodExecution calledMe = mi.getCalledMethodExecution(); + visitor = new MyASTVisitor() { + @Override + public boolean visit(org.eclipse.jdt.core.dom.MethodInvocation node) { + int lineNo = cUnit.getLineNumber(node.getStartPosition()); + if (lineNo != alias.getLineNo()) return true; + String name1 = node.getName().toString() + "("; + String name2 = calledMe.getCallerSideSignature(); + name2 = name2.substring(0, name2.indexOf("(") + 1); + name2 = name2.substring(name2.lastIndexOf(".") + 1); + if (!(name1.equals(name2))) return true; + String receiverName = node.getExpression().toString(); + int start = node.getStartPosition(); + attributes.put(IMarker.CHAR_START, start); + if (source.startsWith("this.", start)) { + attributes.put(IMarker.CHAR_END, start + "this".length()); + } else { + attributes.put(IMarker.CHAR_END, start + receiverName.length()); + } + attributes.put(IMarker.LINE_NUMBER, lineNo); + return false; + } + @Override + public boolean visit(org.eclipse.jdt.core.dom.ClassInstanceCreation node) { + int lineNo = cUnit.getLineNumber(node.getStartPosition()); + if (lineNo != alias.getLineNo()) return true; + String name1 = node.toString(); + name1 = name1.substring("new ".length(), name1.indexOf("(") + 1); + String name2 = calledMe.getCallerSideSignature(); + name2 = name2.substring(0, name2.indexOf("(") + 1); + if (!(name1.equals(name2))) return true; + int start = node.getStartPosition(); + int end = start + node.getLength(); + attributes.put(IMarker.CHAR_START, start); + attributes.put(IMarker.CHAR_END, end); + attributes.put(IMarker.LINE_NUMBER, lineNo); + return false; } }; } @@ -254,14 +297,18 @@ public boolean visit(org.eclipse.jdt.core.dom.MethodInvocation node) { int lineNo = cUnit.getLineNumber(node.getStartPosition()); if (lineNo != alias.getLineNo()) return true; - String name1 = node.getName().toString(); + String name1 = node.getName().toString() + "("; String name2 = calledMe.getCallerSideSignature(); - name1 += "("; name2 = name2.substring(0, name2.indexOf("(") + 1); name2 = name2.substring(name2.lastIndexOf(".") + 1); if (!(name1.equals(name2))) return true; String receiverName = node.getExpression().toString(); - int start = node.getStartPosition() + (receiverName + ".").length(); + int start = node.getStartPosition(); + if (source.startsWith("this.", start)) { + start += ("this." + receiverName + ".").length(); + } else { + start += (receiverName + ".").length(); + } int end = node.getStartPosition() + node.getLength(); attributes.put(IMarker.CHAR_START, start); attributes.put(IMarker.CHAR_END, end); @@ -276,8 +323,6 @@ name1 = name1.substring("new ".length(), name1.indexOf("(") + 1); String name2 = calledMe.getCallerSideSignature(); name2 = name2.substring(0, name2.indexOf("(") + 1); - System.out.println(name1); - System.out.println(name2); if (!(name1.equals(name2))) return true; int start = node.getStartPosition(); int end = start + node.getLength(); @@ -304,8 +349,6 @@ name1 = name1.substring("new ".length(), name1.indexOf("(") + 1); String name2 = calledMe.getCallerSideSignature(); name2 = name2.substring(0, name2.indexOf("(") + 1); - System.out.println(name1); - System.out.println(name2); if (!(name1.equals(name2))) return true; int start = node.getStartPosition(); int end = start + node.getLength(); @@ -377,7 +420,7 @@ attributes.put(IMarker.CHAR_END, end); attributes.put(IMarker.LINE_NUMBER, lineNo); return false; - } + } @Override public boolean visit(org.eclipse.jdt.core.dom.ReturnStatement node) { int lineNo = cUnit.getLineNumber(node.getStartPosition()); @@ -403,8 +446,6 @@ String name1 = node.getName().toString(); String name2 = fa.getFieldName(); name2 = name2.substring(name2.lastIndexOf(".") + 1); - System.out.println(name1); - System.out.println(name2); if (!(name1.equals(name2))) return true; int start = node.getStartPosition(); int end = start + node.getLength(); @@ -474,13 +515,13 @@ visitor = new MyASTVisitor() { @Override public boolean visit(org.eclipse.jdt.core.dom.ArrayCreation node) { -// int lineNo = cUnit.getLineNumber(node.getStartPosition()); -// if (lineNo != ac.getLineNo()) return true; -// int start = node.getStartPosition(); -// int end = start + node.getLength(); -// attributes.put(IMarker.CHAR_START, start); -// attributes.put(IMarker.CHAR_END, end); -// attributes.put(IMarker.LINE_NUMBER, lineNo); + int lineNo = cUnit.getLineNumber(node.getStartPosition()); + if (lineNo != ac.getLineNo()) return true; + int start = node.getStartPosition(); + int end = start + node.getLength(); + attributes.put(IMarker.CHAR_START, start); + attributes.put(IMarker.CHAR_END, end); + attributes.put(IMarker.LINE_NUMBER, lineNo); return false; } }; @@ -591,10 +632,12 @@ @Override public boolean visit(MethodDeclaration node) { try { + if (attributes.containsKey(IMarker.LINE_NUMBER)) return false; String src1 = node.toString().replaceAll(" ", ""); src1 = src1.substring(0, src1.lastIndexOf("\n")); + String src1Head = src1.substring(0, src1.indexOf(")") + 1); String src2 = method.getSource().replaceAll(" |\t|\r", ""); - if (!(src1.equals(src2))) return false; + if (!(src2.contains(src1Head))) return false; int start = node.getStartPosition(); int end = start + node.toString().indexOf(")") + 1; int lineNo = cUnit.getLineNumber(node.getStartPosition()); @@ -604,7 +647,7 @@ } catch (JavaModelException e) { e.printStackTrace(); } - return true; + return false; } }); }