-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fixes #562] Support inlining in eclipse
- Loading branch information
Showing
8 changed files
with
150 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
test/eclipse/resource/inline/getter/after/InlineGetter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package pkg; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class InlineGetter { | ||
private String string; | ||
|
||
public String asReturn() { | ||
return this.string; | ||
} | ||
|
||
public void asAssignment() { | ||
String a = this.string; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
test/eclipse/resource/inline/getter/before/InlineGetter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package pkg; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class InlineGetter { | ||
private String string; | ||
|
||
public String asReturn() { | ||
return getString(); | ||
} | ||
|
||
public void asAssignment() { | ||
String a = getString(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
test/eclipse/resource/inline/setter/after/InlineSetter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package pkg; | ||
|
||
import lombok.Setter; | ||
|
||
@Setter | ||
public class InlineSetter { | ||
private String string; | ||
|
||
public void test() { | ||
this.string="test"; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
test/eclipse/resource/inline/setter/before/InlineSetter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package pkg; | ||
|
||
import lombok.Setter; | ||
|
||
@Setter | ||
public class InlineSetter { | ||
private String string; | ||
|
||
public void test() { | ||
setString("test"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
test/eclipse/src/lombok/eclipse/refactoring/InlineTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package lombok.eclipse.refactoring; | ||
|
||
import static lombok.eclipse.RefactoringUtils.performRefactoring; | ||
|
||
import org.eclipse.jdt.core.ICompilationUnit; | ||
import org.eclipse.jdt.core.dom.CompilationUnit; | ||
import org.eclipse.jdt.internal.corext.refactoring.code.InlineMethodRefactoring; | ||
import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser; | ||
import org.eclipse.jdt.internal.ui.javaeditor.ASTProvider; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import lombok.eclipse.EclipseRunner; | ||
import lombok.eclipse.SetupBeforeAfterTest; | ||
|
||
@RunWith(EclipseRunner.class) | ||
public class InlineTest { | ||
|
||
@Rule | ||
public SetupBeforeAfterTest setup = new SetupBeforeAfterTest(); | ||
|
||
@Test | ||
public void getter() throws Exception { | ||
ICompilationUnit cu = setup.getPackageFragment().getCompilationUnit("InlineGetter.java"); | ||
|
||
CompilationUnit compilationUnit = new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL).parse(cu, true); | ||
|
||
performRefactoring(InlineMethodRefactoring.create(cu, compilationUnit, 139, 0)); | ||
performRefactoring(InlineMethodRefactoring.create(cu, compilationUnit, 200, 0)); | ||
} | ||
|
||
@Test | ||
public void setter() throws Exception { | ||
ICompilationUnit cu = setup.getPackageFragment().getCompilationUnit("InlineSetter.java"); | ||
|
||
CompilationUnit compilationUnit = new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL).parse(cu, true); | ||
|
||
performRefactoring(InlineMethodRefactoring.create(cu, compilationUnit, 126, 0)); | ||
} | ||
} |