### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.ui Index: core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodAnalyzer.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodAnalyzer.java,v retrieving revision 1.76 diff -u -r1.76 ExtractMethodAnalyzer.java --- core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodAnalyzer.java 11 Sep 2008 11:59:46 -0000 1.76 +++ core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodAnalyzer.java 3 Aug 2009 09:14:37 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Benjamin Muskalla - [extract method] Extract method and continue https://bugs.eclipse.org/bugs/show_bug.cgi?id=48056 *******************************************************************************/ package org.eclipse.jdt.internal.corext.refactoring.code; @@ -25,14 +26,18 @@ import org.eclipse.jdt.core.compiler.ITerminalSymbols; import org.eclipse.jdt.core.dom.AST; import org.eclipse.jdt.core.dom.ASTNode; +import org.eclipse.jdt.core.dom.ASTVisitor; import org.eclipse.jdt.core.dom.AnonymousClassDeclaration; import org.eclipse.jdt.core.dom.Assignment; import org.eclipse.jdt.core.dom.Block; import org.eclipse.jdt.core.dom.BodyDeclaration; +import org.eclipse.jdt.core.dom.BreakStatement; import org.eclipse.jdt.core.dom.ClassInstanceCreation; import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jdt.core.dom.ConstructorInvocation; +import org.eclipse.jdt.core.dom.ContinueStatement; import org.eclipse.jdt.core.dom.DoStatement; +import org.eclipse.jdt.core.dom.EnhancedForStatement; import org.eclipse.jdt.core.dom.Expression; import org.eclipse.jdt.core.dom.FieldAccess; import org.eclipse.jdt.core.dom.ForStatement; @@ -40,12 +45,14 @@ import org.eclipse.jdt.core.dom.ITypeBinding; import org.eclipse.jdt.core.dom.IVariableBinding; import org.eclipse.jdt.core.dom.Initializer; +import org.eclipse.jdt.core.dom.LabeledStatement; import org.eclipse.jdt.core.dom.Message; import org.eclipse.jdt.core.dom.MethodDeclaration; import org.eclipse.jdt.core.dom.Name; import org.eclipse.jdt.core.dom.PrimitiveType; import org.eclipse.jdt.core.dom.QualifiedName; import org.eclipse.jdt.core.dom.SimpleName; +import org.eclipse.jdt.core.dom.Statement; import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; import org.eclipse.jdt.core.dom.SuperConstructorInvocation; import org.eclipse.jdt.core.dom.SwitchCase; @@ -55,6 +62,7 @@ import org.eclipse.jdt.core.dom.VariableDeclarationExpression; import org.eclipse.jdt.core.dom.VariableDeclarationFragment; import org.eclipse.jdt.core.dom.VariableDeclarationStatement; +import org.eclipse.jdt.core.dom.WhileStatement; import org.eclipse.jdt.core.dom.rewrite.ImportRewrite; import org.eclipse.jdt.internal.corext.dom.ASTNodeFactory; @@ -110,7 +118,8 @@ private boolean fForceStatic; private boolean fIsLastStatementSelected; - + private SimpleName fEnclosingLoopLabel; + public ExtractMethodAnalyzer(ICompilationUnit unit, Selection selection) throws CoreException { super(unit, selection, false); } @@ -314,9 +323,12 @@ fInputFlowInfo= flowAnalyzer.perform(getSelectedNodes()); if (fInputFlowInfo.branches()) { - status.addFatalError(RefactoringCoreMessages.ExtractMethodAnalyzer_branch_mismatch, JavaStatusContext.create(fCUnit, getSelection())); - fReturnKind= ERROR; - return status; + String canHandleBranchesProblem= canHandleBranches(); + if (canHandleBranchesProblem != null) { + status.addFatalError(canHandleBranchesProblem, JavaStatusContext.create(fCUnit, getSelection())); + fReturnKind= ERROR; + return status; + } } if (fInputFlowInfo.isValueReturn()) { fReturnKind= RETURN_STATEMENT_VALUE; @@ -341,6 +353,88 @@ return status; } + private String canHandleBranches() { + if (fReturnValue != null) + return RefactoringCoreMessages.ExtractMethodAnalyzer_branch_mismatch; + + ASTNode[] selectedNodes= getSelectedNodes(); + final ASTNode lastSelectedNode= selectedNodes[selectedNodes.length - 1]; + Statement body= getParentLoopBody(lastSelectedNode.getParent()); + if (!(body instanceof Block)) + return RefactoringCoreMessages.ExtractMethodAnalyzer_branch_mismatch; + + if (body != lastSelectedNode) { + Block block= (Block)body; + List statements= block.statements(); + ASTNode lastStatementInLoop= (ASTNode)statements.get(statements.size() - 1); + if (lastSelectedNode != lastStatementInLoop) + return RefactoringCoreMessages.ExtractMethodAnalyzer_branch_mismatch; + } + + final String continueMatchesLoopProblem[]= { null }; + for (int i= 0; i < selectedNodes.length; i++) { + final ASTNode astNode= selectedNodes[i]; + astNode.accept(new ASTVisitor() { + ArrayList fLocalLoopLabels= new ArrayList(); + + public boolean visit(BreakStatement node) { + SimpleName label= node.getLabel(); + if (label != null && !fLocalLoopLabels.contains(label.getIdentifier())) { + continueMatchesLoopProblem[0]= Messages.format( + RefactoringCoreMessages.ExtractMethodAnalyzer_branch_break_mismatch, + new Object[] { ("break " + label.getIdentifier()) }); //$NON-NLS-1$ + } + return false; + } + + public boolean visit(LabeledStatement node) { + SimpleName label= node.getLabel(); + if (label != null) + fLocalLoopLabels.add(label.getIdentifier()); + return true; + } + + public void endVisit(ContinueStatement node) { + SimpleName label= node.getLabel(); + if (label != null && !fLocalLoopLabels.contains(label.getIdentifier())) { + if (fEnclosingLoopLabel == null || ! label.getIdentifier().equals(fEnclosingLoopLabel.getIdentifier())) { + continueMatchesLoopProblem[0]= Messages.format( + RefactoringCoreMessages.ExtractMethodAnalyzer_branch_continue_mismatch, + new Object[] { "continue " + label.getIdentifier() }); //$NON-NLS-1$ + } + } + } + }); + } + return continueMatchesLoopProblem[0]; + } + + private Statement getParentLoopBody(ASTNode node) { + Statement stmt= null; + ASTNode start= node; + while (start != null + && !(start instanceof ForStatement) + && !(start instanceof DoStatement) + && !(start instanceof WhileStatement) + && !(start instanceof EnhancedForStatement)) { + start= start.getParent(); + } + if (start instanceof ForStatement) { + stmt= ((ForStatement)start).getBody(); + } else if (start instanceof DoStatement) { + stmt= ((DoStatement)start).getBody(); + } else if (start instanceof WhileStatement) { + stmt= ((WhileStatement)start).getBody(); + } else if (start instanceof EnhancedForStatement) { + stmt= ((EnhancedForStatement)start).getBody(); + } + if (start.getParent() instanceof LabeledStatement) { + LabeledStatement labeledStatement= (LabeledStatement)start.getParent(); + fEnclosingLoopLabel= labeledStatement.getLabel(); + } + return stmt; + } + private boolean isVoidMethod() { // if we have an initializer if (fEnclosingMethodBinding == null) Index: core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodRefactoring.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodRefactoring.java,v retrieving revision 1.166 diff -u -r1.166 ExtractMethodRefactoring.java --- core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodRefactoring.java 13 Jul 2009 16:08:21 -0000 1.166 +++ core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodRefactoring.java 3 Aug 2009 09:14:38 -0000 @@ -8,6 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Benjamin Muskalla - [extract method] Does not replace similar code in parent class of anonymous class - https://bugs.eclipse.org/bugs/show_bug.cgi?id=160853 + * Benjamin Muskalla - [extract method] Extract method and continue https://bugs.eclipse.org/bugs/show_bug.cgi?id=48056 *******************************************************************************/ package org.eclipse.jdt.internal.corext.refactoring.code; @@ -16,6 +17,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -54,16 +56,21 @@ import org.eclipse.jdt.core.dom.BodyDeclaration; import org.eclipse.jdt.core.dom.ChildListPropertyDescriptor; import org.eclipse.jdt.core.dom.CompilationUnit; +import org.eclipse.jdt.core.dom.ContinueStatement; +import org.eclipse.jdt.core.dom.DoStatement; +import org.eclipse.jdt.core.dom.EnhancedForStatement; import org.eclipse.jdt.core.dom.EnumDeclaration; import org.eclipse.jdt.core.dom.Expression; import org.eclipse.jdt.core.dom.ExpressionStatement; import org.eclipse.jdt.core.dom.FieldAccess; import org.eclipse.jdt.core.dom.FieldDeclaration; +import org.eclipse.jdt.core.dom.ForStatement; import org.eclipse.jdt.core.dom.IMethodBinding; import org.eclipse.jdt.core.dom.ITypeBinding; import org.eclipse.jdt.core.dom.IVariableBinding; import org.eclipse.jdt.core.dom.Initializer; import org.eclipse.jdt.core.dom.Javadoc; +import org.eclipse.jdt.core.dom.LabeledStatement; import org.eclipse.jdt.core.dom.MethodDeclaration; import org.eclipse.jdt.core.dom.MethodInvocation; import org.eclipse.jdt.core.dom.Modifier; @@ -71,12 +78,14 @@ import org.eclipse.jdt.core.dom.ReturnStatement; import org.eclipse.jdt.core.dom.SimpleName; import org.eclipse.jdt.core.dom.SingleVariableDeclaration; +import org.eclipse.jdt.core.dom.Statement; import org.eclipse.jdt.core.dom.Type; import org.eclipse.jdt.core.dom.TypeDeclaration; import org.eclipse.jdt.core.dom.TypeParameter; import org.eclipse.jdt.core.dom.VariableDeclaration; import org.eclipse.jdt.core.dom.VariableDeclarationFragment; import org.eclipse.jdt.core.dom.VariableDeclarationStatement; +import org.eclipse.jdt.core.dom.WhileStatement; import org.eclipse.jdt.core.dom.rewrite.ASTRewrite; import org.eclipse.jdt.core.dom.rewrite.ImportRewrite; import org.eclipse.jdt.core.dom.rewrite.ListRewrite; @@ -506,6 +515,7 @@ } replaceDuplicates(result); + replaceBranches(result); //TODO: move into createNewMethod()?? if (fImportRewriter.hasRecordedChanges()) { TextEdit edit= fImportRewriter.rewriteImports(null); @@ -523,6 +533,79 @@ } + private void replaceBranches(final CompilationUnitChange result) { + ASTNode[] selectedNodes= fAnalyzer.getSelectedNodes(); + for (int i= 0; i < selectedNodes.length; i++) { + ASTNode astNode= selectedNodes[i]; + astNode.accept(new ASTVisitor() { + private LinkedList fOpenLoopLabels= new LinkedList(); + + private void registerLoopLabel(Statement node) { + String identifier; + if (node.getParent() instanceof LabeledStatement) { + LabeledStatement labeledStatement= (LabeledStatement)node.getParent(); + identifier= labeledStatement.getLabel().getIdentifier(); + } else { + identifier= null; + } + fOpenLoopLabels.add(identifier); + } + + public boolean visit(ForStatement node) { + registerLoopLabel(node); + return super.visit(node); + } + + public void endVisit(ForStatement node) { + fOpenLoopLabels.removeLast(); + } + + public boolean visit(WhileStatement node) { + registerLoopLabel(node); + return super.visit(node); + } + + public void endVisit(WhileStatement node) { + fOpenLoopLabels.removeLast(); + } + + public boolean visit(EnhancedForStatement node) { + registerLoopLabel(node); + return super.visit(node); + } + + public void endVisit(EnhancedForStatement node) { + fOpenLoopLabels.removeLast(); + } + + public boolean visit(DoStatement node) { + registerLoopLabel(node); + return super.visit(node); + } + + public void endVisit(DoStatement node) { + fOpenLoopLabels.removeLast(); + } + + public void endVisit(ContinueStatement node) { + final SimpleName label= node.getLabel(); + if (fOpenLoopLabels.isEmpty() || (label != null && !fOpenLoopLabels.contains(label.getIdentifier()))) { + TextEditGroup description= new TextEditGroup(RefactoringCoreMessages.ExtractMethodRefactoring_replace_continue); + result.addTextEditGroup(description); + + ReturnStatement rs= fAST.newReturnStatement(); + IVariableBinding returnValue= fAnalyzer.getReturnValue(); + if (returnValue != null) { + rs.setExpression(fAST.newSimpleName(getName(returnValue))); + } + + fRewriter.replace(node, rs, description); + } + } + }); + } + } + private ExtractMethodDescriptor getRefactoringDescriptor() { final Map arguments= new HashMap(); String project= null; Index: core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties,v retrieving revision 1.379 diff -u -r1.379 refactoring.properties --- core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties 12 Jun 2009 18:12:16 -0000 1.379 +++ core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties 3 Aug 2009 09:14:36 -0000 @@ -127,7 +127,9 @@ ExtractMethodAnalyzer_after_do_keyword=Selection may not start immediately after the \'do\' keyword. ExtractMethodAnalyzer_super_or_this=Cannot extract super or this call from constructor. ExtractMethodAnalyzer_cannot_determine_return_type=Cannot determine expression's return type. Using void instead. -ExtractMethodAnalyzer_branch_mismatch=Selection contains branch statement but corresponding branch target is not selected. +ExtractMethodAnalyzer_branch_break_mismatch=Selection contains ''{0}'', but corresponding branch target is not selected. +ExtractMethodAnalyzer_branch_continue_mismatch=Selection contains ''{0}'', but corresponding branch target (or its complete loop body) is not selected. +ExtractMethodAnalyzer_branch_mismatch=Selection contains branch statement but corresponding branch target (or the complete loop body) is not selected. ExtractMethodAnalyzer_parent_mismatch=Not all selected statements are enclosed by the same parent statement. ExtractMethodAnalyzer_cannot_extract_anonymous_type=Cannot extract the body of a anonymous type declaration. Select whole declaration. ExtractMethodAnalyzer_cannot_extract_variable_declaration_fragment=Cannot extract a variable declaration fragment. Select whole declaration statement. @@ -160,6 +162,7 @@ ExtractMethodRefactoring_error_nameInUse=''{0}'' is already used as a name in the selected code ExtractMethodRefactoring_error_sameParameter=A parameter ''{0}'' already exists ExtractMethodRefactoring_visibility_pattern=Declared visibility: ''{0}'' +ExtractMethodRefactoring_replace_continue=Replace continue with return ExtractMethodRefactoring_replace_occurrences=Replace occurrences of statements with method ExtractMethodRefactoring_error_vararg_ordering=The variable arity parameter ''{0}'' cannot be followed by another parameter ExtractMethodRefactoring_descriptor_description=Extract method ''{0}'' from ''{1}'' to ''{2}'' Index: core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java,v retrieving revision 1.122 diff -u -r1.122 RefactoringCoreMessages.java --- core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java 9 Jan 2009 08:50:07 -0000 1.122 +++ core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java 3 Aug 2009 09:14:34 -0000 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Benjamin Muskalla - [extract method] Extract method and continue https://bugs.eclipse.org/bugs/show_bug.cgi?id=48056 *******************************************************************************/ package org.eclipse.jdt.internal.corext.refactoring; @@ -558,6 +559,10 @@ public static String ExtractMethodAnalyzer_assignments_to_local; + public static String ExtractMethodAnalyzer_branch_break_mismatch; + + public static String ExtractMethodAnalyzer_branch_continue_mismatch; + public static String ExtractMethodAnalyzer_branch_mismatch; public static String ExtractMethodAnalyzer_cannot_determine_return_type; @@ -634,6 +639,8 @@ public static String ExtractMethodRefactoring_organize_imports; + public static String ExtractMethodRefactoring_replace_continue; + public static String ExtractMethodRefactoring_replace_occurrences; public static String ExtractMethodRefactoring_substitute_with_call; #P org.eclipse.jdt.ui.tests.refactoring Index: test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests.java,v retrieving revision 1.89 diff -u -r1.89 ExtractMethodTests.java --- test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests.java 13 Jul 2009 17:10:21 -0000 1.89 +++ test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests.java 3 Aug 2009 09:15:13 -0000 @@ -10,6 +10,7 @@ * Benjamin Muskalla - [extract method] Does not replace similar code in parent class of anonymous class - https://bugs.eclipse.org/bugs/show_bug.cgi?id=160853 * Benjamin Muskalla - [extract method] Missing return value, while extracting code out of a loop - https://bugs.eclipse.org/bugs/show_bug.cgi?id=213519 * Benjamin Muskalla - [extract method] missing return type when code can throw exception - https://bugs.eclipse.org/bugs/show_bug.cgi?id=97413 + * Benjamin Muskalla - [extract method] Extract method and continue https://bugs.eclipse.org/bugs/show_bug.cgi?id=48056 *******************************************************************************/ package org.eclipse.jdt.ui.tests.refactoring; @@ -651,6 +652,12 @@ public void test196() throws Exception { invalidSelectionTest(); } + + //---- continue not possible + + public void test197() throws Exception { + invalidSelectionTest(); + } @@ -1616,6 +1623,62 @@ branchTest(); } + public void test756() throws Exception { + branchTest(); + } + + public void test757() throws Exception { + branchTest(); + } + + public void test758() throws Exception { + branchTest(); + } + + public void test759() throws Exception { + branchTest(); + } + + public void test760() throws Exception { + branchTest(); + } + + public void test761() throws Exception { + branchTest(); + } + + public void test762() throws Exception { + branchTest(); + } + + public void test763() throws Exception { + branchTest(); + } + + public void test764() throws Exception { + branchTest(); + } + + public void test765() throws Exception { + branchTest(); + } + + public void test766() throws Exception { + branchTest(); + } + + public void test767() throws Exception { + branchTest(); + } + + public void test768() throws Exception { + branchTest(); + } + + public void test769() throws Exception { + branchTest(); + } + //---- Test for CUs with compiler errors public void test800() throws Exception { Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test768.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test768.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test768.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test768.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,21 @@ +package branch_out; + +public class A_test768 { + + public void foo() { + int i = 0; + do { + extracted(i); + } while ( i < 10 ); + } + + protected void extracted(int i) { + /*[*/ + if( i == 3 ) { + return; + } + System.out.println(); + /*]*/ + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test765.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test765.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test765.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test765.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,19 @@ +package branch_in; + +public class A_test765 { + + public void foo() { + int x = 0; + for (int i= 0; i < 3; i++) { + /*[*/ + if(i == 2) { + x = (i*3); + continue; + } + System.out.println(); + /*]*/ + } + System.out.println(x); + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test763.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test763.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test763.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test763.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,16 @@ +package branch_in; + +public class A_test763 { + + public void foo() { + inner: for (int i= 0; i < 3; i++) { + /*[*/ + if(i == 2) { + continue inner; + } + System.out.println(); + /*]*/ + } + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test766.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test766.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test766.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test766.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,19 @@ +package branch_in; + +public class A_test766 { + + public void foo() { + int x = 0; + foo: for (int i= 0; i < 3; i++) { + /*[*/ + if(i == 2) { + x = (i*3); + continue; + } + System.out.println(); + /*]*/ + } + System.out.println(x); + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test762.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test762.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test762.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test762.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,24 @@ +package branch_out; + +public class A_test762 { + + public void foo() { + outer: for (int i= 0; i < 3; i++) { + extracted(); + } + } + + protected void extracted() { + /*[*/ + for (int j= 0; j < 3; j++) { + for (int k= 0; k < 3; k++) { + if(j == 3) { + return; + } + System.out.println(); + } + } + /*]*/ + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/invalidSelection/A_test197.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/invalidSelection/A_test197.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/invalidSelection/A_test197.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/invalidSelection/A_test197.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,18 @@ +package invalidSelection; + +public class A_test197 { + + public void foo() { + outer: for (int i= 0; i < 3; i++) { + for (int j= 0; j < 3; j++) { + /*[*/ + if(j == 3) { + continue outer; + } + System.out.println(); + /*]*/ + } + } + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test757.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test757.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test757.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test757.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,20 @@ +package branch_out; + +public class A_test757 { + + public void foo() { + extracted(); + } + + protected void extracted() { + /*[*/ + for (int i= 0; i < 3; i++) { + if(i == 2) { + continue; + } + System.out.println(); + } + /*]*/ + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test759.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test759.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test759.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test759.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,16 @@ +package branch_in; + +public class A_test759 { + + public void foo(int a) { + /*[*/ + while (a > 0) { + if(a == 3) { + continue; + } + System.out.println(); + } + /*]*/ + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test762.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test762.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test762.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test762.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,20 @@ +package branch_in; + +public class A_test762 { + + public void foo() { + outer: for (int i= 0; i < 3; i++) { + /*[*/ + for (int j= 0; j < 3; j++) { + for (int k= 0; k < 3; k++) { + if(j == 3) { + continue outer; + } + System.out.println(); + } + } + /*]*/ + } + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test769.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test769.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test769.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test769.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,20 @@ +package branch_out; + +public class A_test769 { + + public void foo(int[] a) { + for(int i : a) { + extracted(i); + } + } + + protected void extracted(int i) { + /*[*/ + if( i == 3 ) { + return; + } + System.out.println(); + /*]*/ + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test765.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test765.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test765.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test765.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,24 @@ +package branch_out; + +public class A_test765 { + + public void foo() { + int x = 0; + for (int i= 0; i < 3; i++) { + x = extracted(x, i); + } + System.out.println(x); + } + + protected int extracted(int x, int i) { + /*[*/ + if(i == 2) { + x = (i*3); + return x; + } + System.out.println(); + /*]*/ + return x; + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test764.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test764.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test764.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test764.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,24 @@ +package branch_out; + +public class A_test764 { + + public void foo() { + int x = 0; + for (int i= 0; i < 3; i++) { + x = extracted(x, i); + } + System.out.println(x); + } + + protected int extracted(int x, int i) { + /*[*/ + if(i == 2) { + x = 2; + return x; + } + System.out.println(); + /*]*/ + return x; + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test758.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test758.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test758.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test758.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,18 @@ +package branch_in; + +import java.util.List; + +public class A_test758 { + + public void foo(List a) { + /*[*/ + for (Object x : a) { + if(x == null) { + continue; + } + System.out.println(); + } + /*]*/ + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test758.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test758.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test758.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test758.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,22 @@ +package branch_out; + +import java.util.List; + +public class A_test758 { + + public void foo(List a) { + extracted(a); + } + + protected void extracted(List a) { + /*[*/ + for (Object x : a) { + if(x == null) { + continue; + } + System.out.println(); + } + /*]*/ + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test767.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test767.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test767.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test767.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,22 @@ +package branch_out; + +public class A_test767 { + + public void foo() { + for (int i = 0; i < 3; i++) { + extracted(); + } + } + + protected void extracted() { + /*[*/ + inner: for (int j = 0; j < 10; j++) { + if (j == 2) { + System.out.println(); + continue inner; + } + } + /*]*/ + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test756.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test756.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test756.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test756.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,16 @@ +package branch_in; + +public class A_test756 { + + public void foo() { + for (int i= 0; i < 3; i++) { + /*[*/ + if(i == 2) { + continue; + } + System.out.println(); + /*]*/ + } + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test769.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test769.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test769.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test769.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,16 @@ +package branch_in; + +public class A_test769 { + + public void foo(int[] a) { + for(int i : a) { + /*[*/ + if( i == 3 ) { + continue; + } + System.out.println(); + /*]*/ + } + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test761.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test761.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test761.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test761.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,18 @@ +package branch_in; + +public class A_test761 { + + public void foo() { + outer: for (int i= 0; i < 3; i++) { + /*[*/ + for (int j= 0; j < 3; j++) { + if(j == 3) { + continue outer; + } + System.out.println(); + } + /*]*/ + } + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test763.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test763.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test763.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test763.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,20 @@ +package branch_out; + +public class A_test763 { + + public void foo() { + inner: for (int i= 0; i < 3; i++) { + extracted(i); + } + } + + protected void extracted(int i) { + /*[*/ + if(i == 2) { + return; + } + System.out.println(); + /*]*/ + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test766.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test766.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test766.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test766.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,24 @@ +package branch_out; + +public class A_test766 { + + public void foo() { + int x = 0; + foo: for (int i= 0; i < 3; i++) { + x = extracted(x, i); + } + System.out.println(x); + } + + protected int extracted(int x, int i) { + /*[*/ + if(i == 2) { + x = (i*3); + return x; + } + System.out.println(); + /*]*/ + return x; + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test764.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test764.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test764.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test764.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,19 @@ +package branch_in; + +public class A_test764 { + + public void foo() { + int x = 0; + for (int i= 0; i < 3; i++) { + /*[*/ + if(i == 2) { + x = 2; + continue; + } + System.out.println(); + /*]*/ + } + System.out.println(x); + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test761.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test761.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test761.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test761.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,22 @@ +package branch_out; + +public class A_test761 { + + public void foo() { + outer: for (int i= 0; i < 3; i++) { + extracted(); + } + } + + protected void extracted() { + /*[*/ + for (int j= 0; j < 3; j++) { + if(j == 3) { + return; + } + System.out.println(); + } + /*]*/ + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test767.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test767.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test767.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test767.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,18 @@ +package branch_in; + +public class A_test767 { + + public void foo() { + for (int i = 0; i < 3; i++) { + /*[*/ + inner: for (int j = 0; j < 10; j++) { + if (j == 2) { + System.out.println(); + continue inner; + } + } + /*]*/ + } + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test760.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test760.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test760.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test760.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,20 @@ +package branch_out; + +public class A_test760 { + + public void foo(int a) { + extracted(a); + } + + protected void extracted(int a) { + /*[*/ + do { + if(a == 3) { + continue; + } + System.out.println(); + } while (a > 0); + /*]*/ + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test760.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test760.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test760.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test760.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,16 @@ +package branch_in; + +public class A_test760 { + + public void foo(int a) { + /*[*/ + do { + if(a == 3) { + continue; + } + System.out.println(); + } while (a > 0); + /*]*/ + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test759.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test759.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test759.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test759.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,20 @@ +package branch_out; + +public class A_test759 { + + public void foo(int a) { + extracted(a); + } + + protected void extracted(int a) { + /*[*/ + while (a > 0) { + if(a == 3) { + continue; + } + System.out.println(); + } + /*]*/ + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test757.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test757.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test757.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test757.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,16 @@ +package branch_in; + +public class A_test757 { + + public void foo() { + /*[*/ + for (int i= 0; i < 3; i++) { + if(i == 2) { + continue; + } + System.out.println(); + } + /*]*/ + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test768.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test768.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test768.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test768.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,17 @@ +package branch_in; + +public class A_test768 { + + public void foo() { + int i = 0; + do { + /*[*/ + if( i == 3 ) { + continue; + } + System.out.println(); + /*]*/ + } while ( i < 10 ); + } +} + Index: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test756.java =================================================================== RCS file: resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test756.java diff -N resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test756.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test756.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,20 @@ +package branch_out; + +public class A_test756 { + + public void foo() { + for (int i= 0; i < 3; i++) { + extracted(i); + } + } + + protected void extracted(int i) { + /*[*/ + if(i == 2) { + return; + } + System.out.println(); + /*]*/ + } +} +