From 4adace3bc037b3b7c36d06edf51caa3c7fe6a5f0 Mon Sep 17 00:00:00 2001 From: Michael Baer Date: Tue, 21 Jul 2015 20:02:28 +0000 Subject: [PATCH] methods in JTD will be analysed (bugfix) Before, methods would only be analysed, if the a parameter shadows an instance variable. But a local variable can shadow an instance var as well. --- src/mujava/op/JTD.java | 291 ++++++++++++++++++----------------------- 1 file changed, 129 insertions(+), 162 deletions(-) diff --git a/src/mujava/op/JTD.java b/src/mujava/op/JTD.java index b174f0f..614db21 100644 --- a/src/mujava/op/JTD.java +++ b/src/mujava/op/JTD.java @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ package mujava.op; import java.io.*; @@ -22,177 +22,144 @@ /** *

Generate JTD (Java-specific this keyword deletion) -- - * delete each occurrence of the keyword this + * delete each occurrence of the keyword this *

* @author Yu-Seung Ma * @version 1.0 - */ - -public class JTD extends mujava.op.util.Mutator -{ - Vector instanceVar = new Vector(); - Vector localVar = new Vector(); - boolean isJTDTarget = false; - - public JTD(FileEnvironment file_env, ClassDeclaration cdecl, CompilationUnit comp_unit) - { - super( file_env, comp_unit ); - } - - public void visit( AssignmentExpression p ) throws ParseTreeException + */ + +public class JTD extends mujava.op.util.Mutator { + Vector instanceVar = new Vector(); + Vector localVar = new Vector(); + boolean isJTDTarget = false; + + public JTD(FileEnvironment file_env, ClassDeclaration cdecl, CompilationUnit comp_unit) { + super(file_env, comp_unit); + } + /* + public void visit( AssignmentExpression p ) throws ParseTreeException { + System.err.println("Assign"); Expression newp = this.evaluateDown( p ); - if (newp != p) + if (newp != p) { + System.err.println("newp != p (1)"); p.replace( newp ); return; } - + p.childrenAccept( this ); newp = this.evaluateUp( p ); - if (newp != p) + if (newp != p) { + System.err.println("newp != p (2)"); p.replace( newp ); - } - - boolean isTarget( Parameter p ) throws ParseTreeException - { - for (int i=0; i